Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1959,6 +1959,17 @@ private void editColor(ColorDefinition definition, Display display) {
}
}

private ThemeElementCategory getCategory() {
IStructuredSelection item = (IStructuredSelection) tree.getViewer().getSelection();
if (item != null && !item.isEmpty()) {
Object object = item.getFirstElement();
if (object instanceof ThemeElementCategory) {
return (ThemeElementCategory) object;
}
}
return null;
}

protected void updateControls() {
FontDefinition fontDefinition = getSelectedFontDefinition();
if (fontDefinition != null) {
Expand All @@ -1984,6 +1995,18 @@ protected void updateControls() {
setCurrentColor(colorDefinition);
return;
}
ThemeElementCategory category = getCategory();
if (category != null) {
fontChangeButton.setEnabled(false);
fontSystemButton.setEnabled(false);
fontResetButton.setEnabled(false);
editDefaultButton.setEnabled(false);
goToDefaultButton.setEnabled(false);

String desc = category.getDescription() != null ? category.getDescription() : ""; //$NON-NLS-1$
descriptionText.setText(desc);
return;
}
// not a font or a color?
fontChangeButton.setEnabled(false);
fontSystemButton.setEnabled(false);
Expand Down
2 changes: 2 additions & 0 deletions examples/org.eclipse.e4.demo.cssbridge/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ org.eclipse.e4.demo.cssbridge.blue.theme=Blue theme
org.eclipse.e4.demo.cssbridge.green.theme=Green theme
org.eclipse.e4.demo.cssbridge.red.theme=Red theme

org.eclipse.e4.demo.cssbridge.ui.views.Theme.description= Colors and fonts used to demonstrate CSS based UI styling.

org.eclipse.e4.demo.cssbridge.ui.views.Theme=CSS bridge demo theme
org.eclipse.e4.demo.cssbridge.ui.views.theme.shell.background=Shell background
org.eclipse.e4.demo.cssbridge.ui.views.theme.shell.selection.foreground=Shell selection foreground
Expand Down
12 changes: 8 additions & 4 deletions examples/org.eclipse.e4.demo.cssbridge/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,14 @@

<!-- The 3.x theme definition -->
<extension point="org.eclipse.ui.themes">
<themeElementCategory
id="org.eclipse.e4.demo.cssbridge.ui.views.Theme"
label="%org.eclipse.e4.demo.cssbridge.ui.views.Theme"/>

<themeElementCategory
id="org.eclipse.e4.demo.cssbridge.ui.views.Theme"
label="%org.eclipse.e4.demo.cssbridge.ui.views.Theme">
<description>
%org.eclipse.e4.demo.cssbridge.ui.views.Theme.description
</description>
</themeElementCategory>

<!-- for IDs see the class: org.eclipse.e4.demo.cssbridge.ui.views.Shell -->
<colorDefinition
id="org.eclipse.e4.demo.cssbridge.ui.views.theme.shell.selection.foreground"
Expand Down
Loading