Skip to content

Commit b7e7e0a

Browse files
vogellailoveeclipse
authored andcommitted
Fix configuration of the unsaved tab dirty indicator
The dirty indicator preference was only shown and stored while CSS theming was active, so it could not be turned off when started with -cssTheme none or in high-contrast mode. It is now created, stored and reset next to the "Show most recently used tabs" option and is therefore always available. The renderer also read the value from the instance scope only, which ignored a default contributed through product customization (SHOW_DIRTY_INDICATOR_ON_TABS in plugin_customization.ini). It now reads via the preferences service so the default scope is honored. Fixes #4130
1 parent 47bc499 commit b7e7e0a

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.util.function.Function;
3535
import java.util.function.Predicate;
3636
import java.util.stream.Stream;
37+
import org.eclipse.core.runtime.Platform;
3738
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
3839
import org.eclipse.e4.core.contexts.IEclipseContext;
3940
import org.eclipse.e4.core.di.annotations.Optional;
@@ -941,8 +942,10 @@ private boolean getMRUValueFromPreferences() {
941942
}
942943

943944
private boolean getShowDirtyIndicatorForTabsFromPreferences() {
944-
return preferences.getBoolean(CTabRendering.SHOW_DIRTY_INDICATOR_ON_TABS,
945-
CTabRendering.SHOW_DIRTY_INDICATOR_ON_TABS_DEFAULT);
945+
// Use the preferences service so product customization (default scope) is honored
946+
return Platform.getPreferencesService().getBoolean(
947+
CTabRendering.PREF_QUALIFIER_ECLIPSE_E4_UI_WORKBENCH_RENDERERS_SWT,
948+
CTabRendering.SHOW_DIRTY_INDICATOR_ON_TABS, CTabRendering.SHOW_DIRTY_INDICATOR_ON_TABS_DEFAULT, null);
946949
}
947950

948951
private void updateMRUValue(CTabFolder tabFolder) {

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ protected Control createContents(Composite parent) {
203203
createHideIconsForViewTabs(comp);
204204
createDependency(showFullTextForViewTabs, hideIconsForViewTabs);
205205

206-
createShowDirtyIndicatorForTabs(comp);
207-
208206
createRescaleAtRuntimeCheckButton(comp);
209207

210208
if (currentTheme != null) {
@@ -259,6 +257,7 @@ private void createRescaleAtRuntimeCheckButton(Composite parent) {
259257
private void createThemeIndependentComposits(Composite comp) {
260258
createColoredLabelsPref(comp);
261259
createEnableMruPref(comp);
260+
createShowDirtyIndicatorForTabs(comp);
262261
}
263262

264263
protected void createShowFullTextForViewTabs(Composite composite) {
@@ -471,9 +470,11 @@ public boolean performOk() {
471470
}
472471
prefs.putBoolean(CTabRendering.HIDE_ICONS_FOR_VIEW_TABS, hideIconsForViewTabs.getSelection());
473472
prefs.putBoolean(CTabRendering.SHOW_FULL_TEXT_FOR_VIEW_TABS, showFullTextForViewTabs.getSelection());
474-
prefs.putBoolean(CTabRendering.SHOW_DIRTY_INDICATOR_ON_TABS, showDirtyIndicatorForTabs.getSelection());
475473
}
476474

475+
// Dirty indicator is independent of CSS theming, so always store it
476+
prefs.putBoolean(CTabRendering.SHOW_DIRTY_INDICATOR_ON_TABS, showDirtyIndicatorForTabs.getSelection());
477+
477478
IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore();
478479
apiStore.setValue(IWorkbenchPreferenceConstants.USE_COLORED_LABELS, useColoredLabels.getSelection());
479480

@@ -624,9 +625,9 @@ protected void performDefaults() {
624625
showFullTextForViewTabs.setSelection(defaultPrefs.getBoolean(CTabRendering.SHOW_FULL_TEXT_FOR_VIEW_TABS,
625626
CTabRendering.SHOW_FULL_TEXT_FOR_VIEW_TABS_DEFAULT));
626627
showFullTextForViewTabs.notifyListeners(SWT.Selection, null);
627-
showDirtyIndicatorForTabs.setSelection(defaultPrefs.getBoolean(CTabRendering.SHOW_DIRTY_INDICATOR_ON_TABS,
628-
CTabRendering.SHOW_DIRTY_INDICATOR_ON_TABS_DEFAULT));
629628
}
629+
showDirtyIndicatorForTabs.setSelection(defaultPrefs.getBoolean(CTabRendering.SHOW_DIRTY_INDICATOR_ON_TABS,
630+
CTabRendering.SHOW_DIRTY_INDICATOR_ON_TABS_DEFAULT));
630631
IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore();
631632
useColoredLabels.setSelection(apiStore.getDefaultBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS));
632633

0 commit comments

Comments
 (0)