mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make sure the restored console content LaF is up-to-date
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.openapi.editor.colors;
|
||||
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.ide.ui.UISettingsListener;
|
||||
import com.intellij.ui.ColorUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -77,4 +79,22 @@ public class EditorColorsUtil {
|
||||
return colorsManager.isDarkEditor() ? colorsManager.getScheme(EditorColorsManager.DEFAULT_SCHEME_NAME)
|
||||
: colorsManager.getGlobalScheme();
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method before showing a hidden component to make sure its LaF and colors are up-to-date.
|
||||
* If a component was not reachable via Swing hierarchy and also was not reported via
|
||||
* {@link UIUtil#NOT_IN_HIERARCHY_COMPONENTS}, its look-and-feel and colors need to be refreshed.
|
||||
*
|
||||
* @see com.intellij.util.ComponentTreeEventDispatcher
|
||||
* @see UIUtil#NOT_IN_HIERARCHY_COMPONENTS
|
||||
*/
|
||||
public static void updateNotInHierarchyComponentUIAndColors(@Nullable Component component) {
|
||||
if (component == null || component.isValid()) return;
|
||||
for (Component o : UIUtil.uiTraverser(component).postOrderDfsTraversal()) {
|
||||
if (o instanceof JComponent) ((JComponent)o).updateUI();
|
||||
if (o instanceof UISettingsListener) ((UISettingsListener)o).uiSettingsChanged(UISettings.getInstance());
|
||||
if (o instanceof EditorColorsListener)
|
||||
((EditorColorsListener)o).globalSchemeChange(EditorColorsManager.getInstance().getGlobalScheme());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user