Skip to content

Commit b2af547

Browse files
committed
Add missing descriptions to Colors and Fonts theme entries
Some Colors and Fonts entries already provide user-facing descriptions via ThemeElementCategory, while others do not. This change uses the existing descriptions to display in the description box and adds description for ones that doesn't have any entries to ensure the description area is not left empty and that available descriptions are consistently utilised. This aligns with the standard usage elsewhere in Eclipse preference pages.
1 parent 60ee73f commit b2af547

3 files changed

Lines changed: 33 additions & 4 deletions

File tree

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,17 @@ private void editColor(ColorDefinition definition, Display display) {
19741974
}
19751975
}
19761976

1977+
private ThemeElementCategory getCategory() {
1978+
IStructuredSelection item = (IStructuredSelection) tree.getViewer().getSelection();
1979+
if (item != null && !item.isEmpty()) {
1980+
Object object = item.getFirstElement();
1981+
if (object instanceof ThemeElementCategory) {
1982+
return (ThemeElementCategory) object;
1983+
}
1984+
}
1985+
return null;
1986+
}
1987+
19771988
protected void updateControls() {
19781989
FontDefinition fontDefinition = getSelectedFontDefinition();
19791990
if (fontDefinition != null) {
@@ -1999,6 +2010,18 @@ protected void updateControls() {
19992010
setCurrentColor(colorDefinition);
20002011
return;
20012012
}
2013+
ThemeElementCategory category = getCategory();
2014+
if (category != null) {
2015+
fontChangeButton.setEnabled(false);
2016+
fontSystemButton.setEnabled(false);
2017+
fontResetButton.setEnabled(false);
2018+
editDefaultButton.setEnabled(false);
2019+
goToDefaultButton.setEnabled(false);
2020+
2021+
String desc = category.getDescription() != null ? category.getDescription() : ""; //$NON-NLS-1$
2022+
descriptionText.setText(desc);
2023+
return;
2024+
}
20022025
// not a font or a color?
20032026
fontChangeButton.setEnabled(false);
20042027
fontSystemButton.setEnabled(false);

examples/org.eclipse.e4.demo.cssbridge/plugin.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ org.eclipse.e4.demo.cssbridge.blue.theme=Blue theme
1919
org.eclipse.e4.demo.cssbridge.green.theme=Green theme
2020
org.eclipse.e4.demo.cssbridge.red.theme=Red theme
2121

22+
org.eclipse.e4.demo.cssbridge.ui.views.Theme.description= Colors and fonts used to demonstrate CSS based UI styling.
23+
2224
org.eclipse.e4.demo.cssbridge.ui.views.Theme=CSS bridge demo theme
2325
org.eclipse.e4.demo.cssbridge.ui.views.theme.shell.background=Shell background
2426
org.eclipse.e4.demo.cssbridge.ui.views.theme.shell.selection.foreground=Shell selection foreground

examples/org.eclipse.e4.demo.cssbridge/plugin.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,14 @@
109109

110110
<!-- The 3.x theme definition -->
111111
<extension point="org.eclipse.ui.themes">
112-
<themeElementCategory
113-
id="org.eclipse.e4.demo.cssbridge.ui.views.Theme"
114-
label="%org.eclipse.e4.demo.cssbridge.ui.views.Theme"/>
115-
112+
<themeElementCategory
113+
id="org.eclipse.e4.demo.cssbridge.ui.views.Theme"
114+
label="%org.eclipse.e4.demo.cssbridge.ui.views.Theme">
115+
<description>
116+
%org.eclipse.e4.demo.cssbridge.ui.views.Theme.description
117+
</description>
118+
</themeElementCategory>
119+
116120
<!-- for IDs see the class: org.eclipse.e4.demo.cssbridge.ui.views.Shell -->
117121
<colorDefinition
118122
id="org.eclipse.e4.demo.cssbridge.ui.views.theme.shell.selection.foreground"

0 commit comments

Comments
 (0)