mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[settings] IJPL-245888 preserve unsaved color scheme edits
When a non-modal Settings dialog is open with unsaved color scheme edits, any code that enumerates configurables (Search Everywhere, reopening Settings via shortcut) triggers buildConfigurables() on a new ColorAndFontOptions instance. This calls initAll() → dropSchemes() on the shared ColorAndFontOptionsModel singleton, wiping the unsaved edits. Guard buildConfigurables() to skip initAll() when the shared model already contains MyColorScheme objects from an active instance. (cherry picked from commit b420c50c7f5a8be55ea3506dc0988712c27aeab8) IJ-CR-210036 GitOrigin-RevId: 5678c13eaf4805ba2d65f7a6e698f46b0f5e060d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
73f543d3d5
commit
b7a251e7d8
+14
-1
@@ -527,7 +527,13 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
|
||||
@Override
|
||||
public @NotNull Configurable @NotNull [] buildConfigurables() {
|
||||
myDisposeCompleted = false;
|
||||
initAll();
|
||||
// Skip initAll() if the shared model already contains MyColorScheme objects from another active
|
||||
// ColorAndFontOptions instance (e.g. an open non-modal Settings dialog). Calling initAll() would
|
||||
// wipe unsaved edits via dropSchemes(). This path is hit when Search Everywhere or other code
|
||||
// enumerates configurables and triggers buildConfigurables() on a throwaway instance.
|
||||
if (!hasMyColorSchemesInModel()) {
|
||||
initAll();
|
||||
}
|
||||
|
||||
List<ColorAndFontPanelFactory> panelFactories = createPanelFactories();
|
||||
|
||||
@@ -669,6 +675,13 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasMyColorSchemesInModel() {
|
||||
for (EditorColorsScheme scheme : myModel.allSchemes()) {
|
||||
if (scheme instanceof MyColorScheme) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void initAll() {
|
||||
EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user