|
25 | 25 | import static org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants.ATT_THEME_ASSOCIATION;
|
26 | 26 | import static org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants.ATT_THEME_ID;
|
27 | 27 |
|
28 |
| -import java.text.Collator; |
29 | 28 | import java.util.ArrayList;
|
30 | 29 | import java.util.HashMap;
|
31 | 30 | import java.util.List;
|
32 |
| -import java.util.Locale; |
33 | 31 | import java.util.Map;
|
34 | 32 | import java.util.Objects;
|
35 | 33 | import org.eclipse.core.runtime.IConfigurationElement;
|
|
57 | 55 | import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
|
58 | 56 | import org.eclipse.jface.preference.IPreferenceStore;
|
59 | 57 | import org.eclipse.jface.preference.PreferencePage;
|
60 |
| -import org.eclipse.jface.util.Util; |
61 | 58 | import org.eclipse.jface.viewers.ArrayContentProvider;
|
62 | 59 | import org.eclipse.jface.viewers.ComboViewer;
|
63 | 60 | import org.eclipse.jface.viewers.ISelection;
|
@@ -113,7 +110,6 @@ public class ViewsPreferencePage extends PreferencePage implements IWorkbenchPre
|
113 | 110 | private ControlDecoration colorFontsDecorator;
|
114 | 111 | private ColorsAndFontsTheme currentColorsAndFontsTheme;
|
115 | 112 | private Map<String, String> themeAssociations;
|
116 |
| - private boolean highContrastMode; |
117 | 113 |
|
118 | 114 | private Button themingEnabled;
|
119 | 115 | private Button rescaleAtRuntime;
|
@@ -147,13 +143,11 @@ protected Control createContents(Composite parent) {
|
147 | 143 | comp.setLayout(layout);
|
148 | 144 |
|
149 | 145 | new Label(comp, SWT.NONE).setText(WorkbenchMessages.ViewsPreferencePage_Theme);
|
150 |
| - highContrastMode = parent.getDisplay().getHighContrast(); |
151 | 146 |
|
152 | 147 | themeIdCombo = new ComboViewer(comp, SWT.READ_ONLY);
|
153 | 148 | themeIdCombo.setLabelProvider(createTextProvider(element -> ((ITheme) element).getLabel()));
|
154 | 149 | themeIdCombo.setContentProvider(ArrayContentProvider.getInstance());
|
155 |
| - themeIdCombo.setInput(getCSSThemes(highContrastMode)); |
156 |
| - themeIdCombo.getCombo().setEnabled(!highContrastMode); |
| 150 | + themeIdCombo.setInput(engine.getThemes()); |
157 | 151 | themeIdCombo.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
158 | 152 | this.currentTheme = engine.getActiveTheme();
|
159 | 153 | if (this.currentTheme != null) {
|
@@ -265,29 +259,6 @@ public void widgetDefaultSelected(SelectionEvent e) {
|
265 | 259 | parent.addSelectionListener(listener);
|
266 | 260 | }
|
267 | 261 |
|
268 |
| - private List<ITheme> getCSSThemes(boolean highContrastMode) { |
269 |
| - ArrayList<ITheme> themes = new ArrayList<>(); |
270 |
| - for (ITheme theme : engine.getThemes()) { |
271 |
| - /* |
272 |
| - * When we have Win32 OS - when the high contrast mode is enabled on the |
273 |
| - * platform, we display the 'high-contrast' special theme only. If not, we don't |
274 |
| - * want to mess the themes combo with the theme since it is the special |
275 |
| - * variation of the 'classic' one |
276 |
| - * |
277 |
| - * When we have GTK - we have to display the entire list of the themes since we |
278 |
| - * are not able to figure out if the high contrast mode is enabled on the |
279 |
| - * platform. The user has to manually select the theme if they need it |
280 |
| - */ |
281 |
| - if (!highContrastMode && !Util.isGtk() && theme.getId().equals(E4Application.HIGH_CONTRAST_THEME_ID)) { |
282 |
| - continue; |
283 |
| - } |
284 |
| - themes.add(theme); |
285 |
| - } |
286 |
| - Collator collator = Collator.getInstance(Locale.getDefault()); |
287 |
| - themes.sort((ITheme t1, ITheme t2) -> collator.compare(t1.getLabel(), t2.getLabel())); |
288 |
| - return themes; |
289 |
| - } |
290 |
| - |
291 | 262 | private void createColoredLabelsPref(Composite composite) {
|
292 | 263 | IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore();
|
293 | 264 |
|
@@ -345,7 +316,7 @@ public boolean performOk() {
|
345 | 316 | if (engine != null) {
|
346 | 317 | ITheme theme = getSelectedTheme();
|
347 | 318 | if (theme != null) {
|
348 |
| - engine.setTheme(getSelectedTheme(), !highContrastMode); |
| 319 | + engine.setTheme(getSelectedTheme(), true); |
349 | 320 | }
|
350 | 321 | prefs.putBoolean(CTabRendering.HIDE_ICONS_FOR_VIEW_TABS, hideIconsForViewTabs.getSelection());
|
351 | 322 | prefs.putBoolean(CTabRendering.SHOW_FULL_TEXT_FOR_VIEW_TABS, showFullTextForViewTabs.getSelection());
|
|
0 commit comments