mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
UISettings — use smart state class (stored properties), part 6
This commit is contained in:
@@ -76,8 +76,8 @@ class UISettings : BaseState(), PersistentStateComponent<UISettings> {
|
||||
@get:OptionTag("LEFT_HORIZONTAL_SPLIT") var leftGorizontalSplit by storedProperty(false)
|
||||
@get:OptionTag("RIGHT_HORIZONTAL_SPLIT") var rightGorizontalSplit by storedProperty(false)
|
||||
@get:OptionTag("SHOW_EDITOR_TOOLTIP") var showEditorToolTip by storedProperty(true)
|
||||
@get:OptionTag("SHOW_MEMORY_INDICATOR") var showMemoryIndicator by storedProperty(false)
|
||||
|
||||
@JvmField var SHOW_MEMORY_INDICATOR = false
|
||||
@JvmField var ALLOW_MERGE_BUTTONS = true
|
||||
@JvmField var SHOW_MAIN_TOOLBAR = false
|
||||
@JvmField var SHOW_STATUS_BAR = true
|
||||
|
||||
@@ -192,8 +192,8 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
settings.setHideToolStripes(!myComponent.myShowToolStripesCheckBox.isSelected());
|
||||
update |= settings.SHOW_ICONS_IN_MENUS != myComponent.myCbDisplayIconsInMenu.isSelected();
|
||||
settings.SHOW_ICONS_IN_MENUS = myComponent.myCbDisplayIconsInMenu.isSelected();
|
||||
update |= settings.SHOW_MEMORY_INDICATOR != myComponent.myShowMemoryIndicatorCheckBox.isSelected();
|
||||
settings.SHOW_MEMORY_INDICATOR = myComponent.myShowMemoryIndicatorCheckBox.isSelected();
|
||||
update |= settings.getShowMemoryIndicator() != myComponent.myShowMemoryIndicatorCheckBox.isSelected();
|
||||
settings.setShowMemoryIndicator(myComponent.myShowMemoryIndicatorCheckBox.isSelected());
|
||||
update |= settings.ALLOW_MERGE_BUTTONS != myComponent.myAllowMergeButtons.isSelected();
|
||||
settings.ALLOW_MERGE_BUTTONS = myComponent.myAllowMergeButtons.isSelected();
|
||||
update |= settings.CYCLE_SCROLLING != myComponent.myCycleScrollingCheckBox.isSelected();
|
||||
@@ -339,7 +339,7 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
myComponent.myWindowShortcutsCheckBox.setSelected(settings.getShowToolWindowsNumbers());
|
||||
myComponent.myShowToolStripesCheckBox.setSelected(!settings.getHideToolStripes());
|
||||
myComponent.myCbDisplayIconsInMenu.setSelected(settings.SHOW_ICONS_IN_MENUS);
|
||||
myComponent.myShowMemoryIndicatorCheckBox.setSelected(settings.SHOW_MEMORY_INDICATOR);
|
||||
myComponent.myShowMemoryIndicatorCheckBox.setSelected(settings.getShowMemoryIndicator());
|
||||
myComponent.myAllowMergeButtons.setSelected(settings.ALLOW_MERGE_BUTTONS);
|
||||
myComponent.myCycleScrollingCheckBox.setSelected(settings.CYCLE_SCROLLING);
|
||||
|
||||
@@ -406,7 +406,7 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
isModified |= myComponent.myWindowShortcutsCheckBox.isSelected() != settings.getShowToolWindowsNumbers();
|
||||
isModified |= myComponent.myShowToolStripesCheckBox.isSelected() == settings.getHideToolStripes();
|
||||
isModified |= myComponent.myCbDisplayIconsInMenu.isSelected() != settings.SHOW_ICONS_IN_MENUS;
|
||||
isModified |= myComponent.myShowMemoryIndicatorCheckBox.isSelected() != settings.SHOW_MEMORY_INDICATOR;
|
||||
isModified |= myComponent.myShowMemoryIndicatorCheckBox.isSelected() != settings.getShowMemoryIndicator();
|
||||
isModified |= myComponent.myAllowMergeButtons.isSelected() != settings.ALLOW_MERGE_BUTTONS;
|
||||
isModified |= myComponent.myCycleScrollingCheckBox.isSelected() != settings.CYCLE_SCROLLING;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -153,6 +153,7 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
/**
|
||||
* Invoked when enclosed frame is being shown.
|
||||
*/
|
||||
@Override
|
||||
public final void addNotify(){
|
||||
super.addNotify();
|
||||
}
|
||||
@@ -160,6 +161,7 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
/**
|
||||
* Invoked when enclosed frame is being disposed.
|
||||
*/
|
||||
@Override
|
||||
public final void removeNotify(){
|
||||
if (ScreenUtil.isStandardAddRemoveNotify(this)) {
|
||||
if (!myStatusBarDisposed) {
|
||||
@@ -191,6 +193,7 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
contentPane.revalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JLayeredPane createLayeredPane() {
|
||||
JLayeredPane p = new JBLayeredPane();
|
||||
p.setName(this.getName()+".layeredPane");
|
||||
@@ -204,6 +207,7 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
super.setLayout(mgr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Container createContentPane(){
|
||||
return myContentPane = new IdePanePanel(new BorderLayout());
|
||||
}
|
||||
@@ -262,22 +266,27 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
for (final StatusBarCustomComponentFactory<JComponent> componentFactory : myStatusBarCustomComponentFactories) {
|
||||
final JComponent c = componentFactory.createComponent(myStatusBar);
|
||||
myStatusBar.addWidget(new CustomStatusBarWidget() {
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String ID() {
|
||||
return c.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WidgetPresentation getPresentation(@NotNull PlatformType type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void install(@NotNull StatusBar statusBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
componentFactory.disposeComponent(myStatusBar, c);
|
||||
}
|
||||
@@ -288,7 +297,7 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
myStatusBar.addWidget(myMemoryWidget);
|
||||
myStatusBar.addWidget(new IdeMessagePanel(frame, MessagePool.getInstance()), "before " + MemoryUsagePanel.WIDGET_ID);
|
||||
|
||||
setMemoryIndicatorVisible(UISettings.getInstance().SHOW_MEMORY_INDICATOR);
|
||||
setMemoryIndicatorVisible(UISettings.getInstance().getShowMemoryIndicator());
|
||||
}
|
||||
|
||||
void setMemoryIndicatorVisible(final boolean visible) {
|
||||
@@ -342,8 +351,9 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uiSettingsChanged(UISettings uiSettings) {
|
||||
setMemoryIndicatorVisible(uiSettings.SHOW_MEMORY_INDICATOR);
|
||||
setMemoryIndicatorVisible(uiSettings.getShowMemoryIndicator());
|
||||
updateToolbarVisibility();
|
||||
updateStatusBarVisibility();
|
||||
for (IdeRootPaneNorthExtension component : myNorthComponents) {
|
||||
@@ -359,6 +369,7 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
}
|
||||
|
||||
private class MyRootLayout extends RootLayout {
|
||||
@Override
|
||||
public Dimension preferredLayoutSize(Container parent) {
|
||||
Dimension rd, mbd;
|
||||
Insets i = getInsets();
|
||||
@@ -379,6 +390,7 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
rd.height + mbd.height + i.top + i.bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(Container parent) {
|
||||
Dimension rd, mbd;
|
||||
Insets i = getInsets();
|
||||
@@ -398,6 +410,7 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
rd.height + mbd.height + i.top + i.bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension maximumLayoutSize(Container target) {
|
||||
Dimension rd, mbd;
|
||||
Insets i = getInsets();
|
||||
@@ -418,6 +431,7 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
rd.height + mbd.height + i.top + i.bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutContainer(Container parent) {
|
||||
Rectangle b = parent.getBounds();
|
||||
Insets i = getInsets();
|
||||
|
||||
+2
-2
@@ -164,7 +164,7 @@ public class PyCharmEduInitialConfigurator {
|
||||
propertiesComponent.setValue("toolwindow.stripes.buttons.info.shown", "true");
|
||||
|
||||
uiSettings.setHideToolStripes(false);
|
||||
uiSettings.SHOW_MEMORY_INDICATOR = false;
|
||||
uiSettings.setShowMemoryIndicator(false);
|
||||
uiSettings.SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES = true;
|
||||
uiSettings.SHOW_MAIN_TOOLBAR = false;
|
||||
|
||||
@@ -178,7 +178,7 @@ public class PyCharmEduInitialConfigurator {
|
||||
settings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
|
||||
settings.getCommonSettings(PythonLanguage.getInstance()).ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
|
||||
uiSettings.SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES = true;
|
||||
uiSettings.SHOW_MEMORY_INDICATOR = false;
|
||||
uiSettings.setShowMemoryIndicator(false);
|
||||
final String ignoredFilesList = fileTypeManager.getIgnoredFilesList();
|
||||
ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> FileTypeManager.getInstance().setIgnoredFilesList(ignoredFilesList + ";*$py.class")));
|
||||
PyCodeInsightSettings.getInstance().SHOW_IMPORT_POPUP = false;
|
||||
|
||||
@@ -55,7 +55,7 @@ public final class PyCharmInitialConfigurator {
|
||||
}
|
||||
if (!propertiesComponent.getBoolean("PyCharm.InitialConfiguration.V3")) {
|
||||
propertiesComponent.setValue("PyCharm.InitialConfiguration.V3", "true");
|
||||
UISettings.getInstance().SHOW_MEMORY_INDICATOR = false;
|
||||
UISettings.getInstance().setShowMemoryIndicator(false);
|
||||
final String ignoredFilesList = fileTypeManager.getIgnoredFilesList();
|
||||
ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> FileTypeManager.getInstance().setIgnoredFilesList(ignoredFilesList + ";*$py.class")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user