diff --git a/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.kt b/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.kt index 7885e2ea4835..f19ba904be06 100644 --- a/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.kt +++ b/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.kt @@ -144,14 +144,15 @@ class UISettings : BaseState(), PersistentStateComponent { @get:OptionTag("MAX_CLIPBOARD_CONTENTS") var maxClipboardContents by storedProperty(5) @get:OptionTag("OVERRIDE_NONIDEA_LAF_FONTS") var overrideLafFonts by storedProperty(false) @get:OptionTag("SHOW_ICONS_IN_MENUS") var showIconsInMenus by storedProperty(true) - @JvmField var DISABLE_MNEMONICS = SystemInfo.isMac // IDEADEV-33409, should be disabled by default on MacOS - @JvmField var DISABLE_MNEMONICS_IN_CONTROLS = false - @JvmField var USE_SMALL_LABELS_ON_TABS = SystemInfo.isMac - @JvmField var MAX_LOOKUP_WIDTH2 = 500 - @JvmField var MAX_LOOKUP_LIST_HEIGHT = 11 - @JvmField var HIDE_NAVIGATION_ON_FOCUS_LOSS = true - @JvmField var DND_WITH_PRESSED_ALT_ONLY = false - @JvmField var DEFAULT_AUTOSCROLL_TO_SOURCE = false + // IDEADEV-33409, should be disabled by default on MacOS + @get:OptionTag("DISABLE_MNEMONICS") var disableMnemonics by storedProperty(SystemInfo.isMac) + @get:OptionTag("DISABLE_MNEMONICS_IN_CONTROLS") var disableMnemonicsInControls by storedProperty(false) + @get:OptionTag("USE_SMALL_LABELS_ON_TABS") var useSmallLabelsOnTabs by storedProperty(SystemInfo.isMac) + @get:OptionTag("MAX_LOOKUP_WIDTH2") var maxLookupWidth by storedProperty(500) + @get:OptionTag("MAX_LOOKUP_LIST_HEIGHT") var maxLookupListHeight by storedProperty(11) + @get:OptionTag("HIDE_NAVIGATION_ON_FOCUS_LOSS") var hideNavigationOnFocusLoss by storedProperty(true) + @get:OptionTag("DND_WITH_PRESSED_ALT_ONLY") var dndWithPressedAltOnly by storedProperty(false) + @get:OptionTag("DEFAULT_AUTOSCROLL_TO_SOURCE") var defaultAutoScrollToSource by storedProperty(false) @Transient var presentationMode = false @get:OptionTag("PRESENTATION_MODE_FONT_SIZE") var presentationModeFontSize by storedProperty(24) @get:OptionTag("MARK_MODIFIED_TABS_WITH_ASTERISK") var markModifiedTabsWithAsterisk by storedProperty(false) @@ -173,9 +174,8 @@ class UISettings : BaseState(), PersistentStateComponent { init { tweakPlatformDefaults() - val scrollToSource = WelcomeWizardUtil.getAutoScrollToSource() - if (scrollToSource != null) { - DEFAULT_AUTOSCROLL_TO_SOURCE = scrollToSource + WelcomeWizardUtil.getAutoScrollToSource()?.let { + defaultAutoScrollToSource = it } } diff --git a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/Presentation.java b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/Presentation.java index bcb6815a85f9..205df557d1c7 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/Presentation.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/Presentation.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 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. @@ -137,7 +137,7 @@ public final class Presentation implements Cloneable { if (i >= text.length()) break; ch = text.charAt(i); if (ch != '_' && ch != '&') { - if (UISettings.getInstance().DISABLE_MNEMONICS_IN_CONTROLS) { + if (UISettings.getInstance().getDisableMnemonicsInControls()) { myMnemonic = 0; myDisplayedMnemonicIndex = -1; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArranger.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArranger.java index 87928d9422e7..03c9536b6a55 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArranger.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArranger.java @@ -279,7 +279,7 @@ public class CompletionLookupArranger extends LookupArranger { private static void ensureEverythingVisibleAdded(LookupImpl lookup, final LinkedHashSet model, Iterator byRelevance) { JList list = lookup.getList(); final boolean testMode = ApplicationManager.getApplication().isUnitTestMode(); - final int limit = Math.max(list.getLastVisibleIndex(), model.size()) + ourUISettings.MAX_LOOKUP_LIST_HEIGHT * 3; + final int limit = Math.max(list.getLastVisibleIndex(), model.size()) + ourUISettings.getMaxLookupListHeight() * 3; addSomeItems(model, byRelevance, lastAdded -> !testMode && model.size() >= limit); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java index e9201725ac6e..1150440b47b9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java @@ -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. @@ -432,7 +432,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable private void updateListHeight(ListModel model) { myList.setFixedCellHeight(myCellRenderer.getListCellRendererComponent(myList, model.getElementAt(0), 0, false, false).getPreferredSize().height); - myList.setVisibleRowCount(Math.min(model.getSize(), UISettings.getInstance().MAX_LOOKUP_LIST_HEIGHT)); + myList.setVisibleRowCount(Math.min(model.getSize(), UISettings.getInstance().getMaxLookupListHeight())); } private void addEmptyItem(CollectionListModel model) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupUi.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupUi.java index 174c5b4c0cec..4201da08b1af 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupUi.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupUi.java @@ -317,7 +317,7 @@ class LookupUi { public Dimension preferredLayoutSize(@Nullable Container parent) { int maxCellWidth = myLookup.myLookupTextWidth + myLookup.myCellRenderer.getTextIndent(); int scrollBarWidth = myScrollPane.getPreferredSize().width - myScrollPane.getViewport().getPreferredSize().width; - int listWidth = Math.min(scrollBarWidth + maxCellWidth, UISettings.getInstance().MAX_LOOKUP_WIDTH2); + int listWidth = Math.min(scrollBarWidth + maxCellWidth, UISettings.getInstance().getMaxLookupWidth()); Dimension adSize = myAdvertiser.getAdComponent().getPreferredSize(); @@ -337,12 +337,12 @@ class LookupUi { if (!myLookup.myResizePending) { Dimension preferredSize = preferredLayoutSize(null); if (preferredSize.width != size.width) { - UISettings.getInstance().MAX_LOOKUP_WIDTH2 = Math.max(500, size.width); + UISettings.getInstance().setMaxLookupWidth(Math.max(500, size.width)); } int listHeight = myList.getLastVisibleIndex() - myList.getFirstVisibleIndex() + 1; if (listHeight != myList.getModel().getSize() && listHeight != myList.getVisibleRowCount() && preferredSize.height != size.height) { - UISettings.getInstance().MAX_LOOKUP_LIST_HEIGHT = Math.max(5, listHeight); + UISettings.getInstance().setMaxLookupListHeight(Math.max(5, listHeight)); } } diff --git a/platform/lang-impl/src/com/intellij/find/EditorSearchSession.java b/platform/lang-impl/src/com/intellij/find/EditorSearchSession.java index 4bc6ebde1423..373b844e661d 100644 --- a/platform/lang-impl/src/com/intellij/find/EditorSearchSession.java +++ b/platform/lang-impl/src/com/intellij/find/EditorSearchSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 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. @@ -468,7 +468,7 @@ public class EditorSearchSession implements SearchSession, public JComponent createCustomComponent(Presentation presentation) { JButton button = new JButton(myTitle); button.setFocusable(false); - if (!UISettings.getInstance().DISABLE_MNEMONICS_IN_CONTROLS) { + if (!UISettings.getInstance().getDisableMnemonicsInControls()) { button.setMnemonic(myMnemonic); } button.addActionListener(this); diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java index 6d2a0591bbe3..2151736b31c5 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java @@ -137,7 +137,6 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo private static final boolean ourAutoscrollFromSourceDefaults = false; private boolean myFoldersAlwaysOnTop = true; - private String myCurrentViewId; private String myCurrentViewSubId; @@ -1383,7 +1382,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo return getGlobalOptions().getAutoscrollToSource(); } - return getPaneOptionValue(myAutoscrollToSource, paneId, UISettings.getInstance().DEFAULT_AUTOSCROLL_TO_SOURCE); + return getPaneOptionValue(myAutoscrollToSource, paneId, UISettings.getInstance().getDefaultAutoScrollToSource()); } public void setAutoscrollToSource(boolean autoscrollMode, String paneId) { diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNamePopup.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNamePopup.java index 949c44334cbc..6577b11ae924 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNamePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNamePopup.java @@ -135,7 +135,7 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP @Override protected boolean isCloseByFocusLost() { - return UISettings.getInstance().HIDE_NAVIGATION_ON_FOCUS_LOSS; + return UISettings.getInstance().getHideNavigationOnFocusLoss(); } @Override @@ -193,7 +193,7 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP // in 'focus follows mouse' mode, to avoid focus escaping to editor, don't reduce popup size when list size is reduced final Dimension currentSize = myDropdownPopup.getSize(); - if (UISettings.getInstance().HIDE_NAVIGATION_ON_FOCUS_LOSS || + if (UISettings.getInstance().getHideNavigationOnFocusLoss() || preferredBounds.width > currentSize.width || preferredBounds.height > currentSize.height) { myDropdownPopup.setSize(preferredBounds.getSize()); } diff --git a/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java b/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java index 1d178939ef4a..d38a05ebe16d 100644 --- a/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java +++ b/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java @@ -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. @@ -176,7 +176,7 @@ abstract class MnemonicWrapper implements Runnable, Propert } boolean isDisabled() { - return UISettings.getShadowInstance().DISABLE_MNEMONICS_IN_CONTROLS; + return UISettings.getShadowInstance().getDisableMnemonicsInControls(); } abstract String getText(); diff --git a/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java b/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java index e46748c3a56f..3a49e618f9e7 100644 --- a/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java +++ b/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 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. @@ -62,7 +62,7 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe * @return false if Settings -> Appearance -> Drag-n-Drop with ALT pressed only is selected but event doesn't have ALT modifier */ public static boolean checkModifiers(InputEvent event) { - if (event == null || !UISettings.getInstance().DND_WITH_PRESSED_ALT_ONLY) return true; + if (event == null || !UISettings.getInstance().getDndWithPressedAltOnly()) return true; return (event.getModifiers() & InputEvent.ALT_MASK) != 0; } @@ -70,16 +70,19 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe if (myGlassPane != null) return; new UiNotifyConnector(myDragComponent, new Activatable() { + @Override public void showNotify() { attach(); } + @Override public void hideNotify() { detach(true); } }); Disposer.register(myParentDisposable, new Disposable() { + @Override public void dispose() { stop(); } @@ -125,6 +128,7 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe return 2; } + @Override public void mousePressed(final MouseEvent e) { if (!canStartDragging(e)) return; @@ -141,6 +145,7 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe } } + @Override public void mouseReleased(final MouseEvent e) { if (myCancelled) { myCancelled = false; @@ -179,6 +184,7 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe myDetachingMode = false; } + @Override public void mouseDragged(final MouseEvent e) { if (myPressPointScreen == null || myCancelled) return; @@ -260,15 +266,19 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe Math.abs(myPressPointScreen.y - screen.y - myDelta.height) < DRAG_START_DEADZONE; } + @Override public void mouseClicked(final MouseEvent e) { } + @Override public void mouseEntered(final MouseEvent e) { } + @Override public void mouseExited(final MouseEvent e) { } + @Override public void mouseMoved(final MouseEvent e) { } diff --git a/platform/platform-api/src/com/intellij/ui/NonFocusableCheckBox.java b/platform/platform-api/src/com/intellij/ui/NonFocusableCheckBox.java index 34d40667e010..f9c89fd5ee01 100644 --- a/platform/platform-api/src/com/intellij/ui/NonFocusableCheckBox.java +++ b/platform/platform-api/src/com/intellij/ui/NonFocusableCheckBox.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 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. @@ -34,7 +34,7 @@ public class NonFocusableCheckBox extends JCheckBox { } private void initFocusability() { - if (!UISettings.getShadowInstance().DISABLE_MNEMONICS_IN_CONTROLS) { // Or that won't be keyboard accessible at all + if (!UISettings.getShadowInstance().getDisableMnemonicsInControls()) { // Or that won't be keyboard accessible at all setFocusable(false); } } diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java index 0aa916a2a519..4d7686adf8a1 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java @@ -103,7 +103,7 @@ public class JBEditorTabs extends JBTabsImpl { @Override public boolean useSmallLabels() { - return UISettings.getInstance().USE_SMALL_LABELS_ON_TABS; + return UISettings.getInstance().getUseSmallLabelsOnTabs(); } @Override @@ -116,8 +116,6 @@ public class JBEditorTabs extends JBTabsImpl { return isSingleRow() && !Registry.is("ide.new.editor.tabs.selection"); } - - @Override protected void doPaintInactive(Graphics2D g2d, boolean leftGhostExists, diff --git a/platform/platform-api/src/com/intellij/util/ui/DialogUtil.java b/platform/platform-api/src/com/intellij/util/ui/DialogUtil.java index 6a04e529ffaa..942a6b1376da 100644 --- a/platform/platform-api/src/com/intellij/util/ui/DialogUtil.java +++ b/platform/platform-api/src/com/intellij/util/ui/DialogUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 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. @@ -54,7 +54,7 @@ public class DialogUtil{ } if (mnemonic != '\0') { button.setText(realText.toString()); - if (UISettings.getShadowInstance().DISABLE_MNEMONICS_IN_CONTROLS) { + if (UISettings.getShadowInstance().getDisableMnemonicsInControls()) { button.setMnemonic(0); button.setDisplayedMnemonicIndex(-1); button.setFocusable(true); @@ -94,7 +94,7 @@ public class DialogUtil{ } if (mnemonic != '\0') { label.setText(realText.toString()); - if (UISettings.getShadowInstance().DISABLE_MNEMONICS_IN_CONTROLS) { + if (UISettings.getShadowInstance().getDisableMnemonicsInControls()) { label.setDisplayedMnemonic(0); label.setDisplayedMnemonicIndex(-1); } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/AppearanceConfigurable.java b/platform/platform-impl/src/com/intellij/ide/ui/AppearanceConfigurable.java index 62aa73175358..216ec593647d 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/AppearanceConfigurable.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/AppearanceConfigurable.java @@ -204,14 +204,14 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab } settings.setOverrideLafFonts(myComponent.myOverrideLAFFonts.isSelected()); settings.setMoveMouseOnDefaultButton(myComponent.myMoveMouseOnDefaultButtonCheckBox.isSelected()); - settings.HIDE_NAVIGATION_ON_FOCUS_LOSS = myComponent.myHideNavigationPopupsCheckBox.isSelected(); - settings.DND_WITH_PRESSED_ALT_ONLY = myComponent.myAltDNDCheckBox.isSelected(); + settings.setHideNavigationOnFocusLoss(myComponent.myHideNavigationPopupsCheckBox.isSelected()); + settings.setDndWithPressedAltOnly(myComponent.myAltDNDCheckBox.isSelected()); - update |= settings.DISABLE_MNEMONICS != myComponent.myDisableMnemonics.isSelected(); - settings.DISABLE_MNEMONICS = myComponent.myDisableMnemonics.isSelected(); + update |= settings.getDisableMnemonics() != myComponent.myDisableMnemonics.isSelected(); + settings.setDisableMnemonics(myComponent.myDisableMnemonics.isSelected()); - update |= settings.USE_SMALL_LABELS_ON_TABS != myComponent.myUseSmallLabelsOnTabs.isSelected(); - settings.USE_SMALL_LABELS_ON_TABS = myComponent.myUseSmallLabelsOnTabs.isSelected(); + update |= settings.getUseSmallLabelsOnTabs() != myComponent.myUseSmallLabelsOnTabs.isSelected(); + settings.setUseSmallLabelsOnTabs(myComponent.myUseSmallLabelsOnTabs.isSelected()); update |= settings.getWideScreenSupport() != myComponent.myWidescreenLayoutCheckBox.isSelected(); settings.setWideScreenSupport(myComponent.myWidescreenLayoutCheckBox.isSelected()); @@ -234,8 +234,8 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab updateEditorScheme = true; } - update |= settings.DISABLE_MNEMONICS_IN_CONTROLS != myComponent.myDisableMnemonicInControlsCheckBox.isSelected(); - settings.DISABLE_MNEMONICS_IN_CONTROLS = myComponent.myDisableMnemonicInControlsCheckBox.isSelected(); + update |= settings.getDisableMnemonicsInControls() != myComponent.myDisableMnemonicInControlsCheckBox.isSelected(); + settings.setDisableMnemonicsInControls(myComponent.myDisableMnemonicInControlsCheckBox.isSelected()); update |= settings.getShowIconInQuickNavigation() != myComponent.myHideIconsInQuickNavigation.isSelected(); settings.setShowIconInQuickNavigation(myComponent.myHideIconsInQuickNavigation.isSelected()); @@ -337,19 +337,19 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab myComponent.myHideIconsInQuickNavigation.setSelected(settings.getShowIconInQuickNavigation()); myComponent.myMoveMouseOnDefaultButtonCheckBox.setSelected(settings.getMoveMouseOnDefaultButton()); - myComponent.myHideNavigationPopupsCheckBox.setSelected(settings.HIDE_NAVIGATION_ON_FOCUS_LOSS); - myComponent.myAltDNDCheckBox.setSelected(settings.DND_WITH_PRESSED_ALT_ONLY); + myComponent.myHideNavigationPopupsCheckBox.setSelected(settings.getHideNavigationOnFocusLoss()); + myComponent.myAltDNDCheckBox.setSelected(settings.getDndWithPressedAltOnly()); myComponent.myLafComboBox.setSelectedItem(LafManager.getInstance().getCurrentLookAndFeel()); myComponent.myOverrideLAFFonts.setSelected(settings.getOverrideLafFonts()); - myComponent.myDisableMnemonics.setSelected(settings.DISABLE_MNEMONICS); - myComponent.myUseSmallLabelsOnTabs.setSelected(settings.USE_SMALL_LABELS_ON_TABS); + myComponent.myDisableMnemonics.setSelected(settings.getDisableMnemonics()); + myComponent.myUseSmallLabelsOnTabs.setSelected(settings.getUseSmallLabelsOnTabs()); myComponent.myWidescreenLayoutCheckBox.setSelected(settings.getWideScreenSupport()); myComponent.myLeftLayoutCheckBox.setSelected(settings.getLeftHorizontalSplit()); myComponent.myRightLayoutCheckBox.setSelected(settings.getRightHorizontalSplit()); myComponent.myNavigateToPreviewCheckBox.setSelected(settings.getNavigateToPreview()); myComponent.myNavigateToPreviewCheckBox.setVisible(false);//disabled for a while myComponent.myColorBlindnessPanel.setColorBlindness(settings.COLOR_BLINDNESS); - myComponent.myDisableMnemonicInControlsCheckBox.setSelected(settings.DISABLE_MNEMONICS_IN_CONTROLS); + myComponent.myDisableMnemonicInControlsCheckBox.setSelected(settings.getDisableMnemonicsInControls()); boolean alphaModeEnabled = WindowManagerEx.getInstanceEx().isAlphaModeSupported(); if (alphaModeEnabled) { @@ -404,10 +404,10 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab isModified |= myComponent.myOverrideLAFFonts.isSelected() != settings.getOverrideLafFonts(); - isModified |= myComponent.myDisableMnemonics.isSelected() != settings.DISABLE_MNEMONICS; - isModified |= myComponent.myDisableMnemonicInControlsCheckBox.isSelected() != settings.DISABLE_MNEMONICS_IN_CONTROLS; + isModified |= myComponent.myDisableMnemonics.isSelected() != settings.getDisableMnemonics(); + isModified |= myComponent.myDisableMnemonicInControlsCheckBox.isSelected() != settings.getDisableMnemonicsInControls(); - isModified |= myComponent.myUseSmallLabelsOnTabs.isSelected() != settings.USE_SMALL_LABELS_ON_TABS; + isModified |= myComponent.myUseSmallLabelsOnTabs.isSelected() != settings.getUseSmallLabelsOnTabs(); isModified |= myComponent.myWidescreenLayoutCheckBox.isSelected() != settings.getWideScreenSupport(); isModified |= myComponent.myLeftLayoutCheckBox.isSelected() != settings.getLeftHorizontalSplit(); isModified |= myComponent.myRightLayoutCheckBox.isSelected() != settings.getRightHorizontalSplit(); @@ -419,8 +419,8 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab isModified |= !Comparing.equal(myComponent.myPresentationModeFontSize.getEditor().getItem(), Integer.toString(settings.getPresentationModeFontSize())); isModified |= myComponent.myMoveMouseOnDefaultButtonCheckBox.isSelected() != settings.getMoveMouseOnDefaultButton(); - isModified |= myComponent.myHideNavigationPopupsCheckBox.isSelected() != settings.HIDE_NAVIGATION_ON_FOCUS_LOSS; - isModified |= myComponent.myAltDNDCheckBox.isSelected() != settings.DND_WITH_PRESSED_ALT_ONLY; + isModified |= myComponent.myHideNavigationPopupsCheckBox.isSelected() != settings.getHideNavigationOnFocusLoss(); + isModified |= myComponent.myAltDNDCheckBox.isSelected() != settings.getDndWithPressedAltOnly(); isModified |= !Comparing.equal(myComponent.myLafComboBox.getSelectedItem(), LafManager.getInstance().getCurrentLookAndFeel()); if (WindowManagerEx.getInstanceEx().isAlphaModeSupported()) { isModified |= myComponent.myEnableAlphaModeCheckBox.isSelected() != settings.getEnableAlphaMode(); diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionPopupMenuImpl.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionPopupMenuImpl.java index 2cc85907c203..3df6880cf715 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionPopupMenuImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionPopupMenuImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 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. @@ -58,6 +58,7 @@ public final class ActionPopupMenuImpl extends ApplicationActivationListener.Ada myApp = ApplicationManager.getApplication(); } + @Override public JPopupMenu getComponent() { return myMenu; } @@ -79,6 +80,7 @@ public final class ActionPopupMenuImpl extends ApplicationActivationListener.Ada addPopupMenuListener(new MyPopupMenuListener()); } + @Override public void show(final Component component, int x, int y) { if (!component.isShowing()) { //noinspection HardCodedStringLiteral @@ -118,10 +120,12 @@ public final class ActionPopupMenuImpl extends ApplicationActivationListener.Ada } private class MyPopupMenuListener implements PopupMenuListener { + @Override public void popupMenuCanceled(PopupMenuEvent e) { disposeMenu(); } + @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { disposeMenu(); } @@ -134,9 +138,10 @@ public final class ActionPopupMenuImpl extends ApplicationActivationListener.Ada } } + @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { MyMenu.this.removeAll(); - Utils.fillMenu(myGroup, MyMenu.this, !UISettings.getInstance().DISABLE_MNEMONICS, myPresentationFactory, myContext, myPlace, false, + Utils.fillMenu(myGroup, MyMenu.this, !UISettings.getInstance().getDisableMnemonics(), myPresentationFactory, myContext, myPlace, false, false, LaterInvocator.isInModalContext()); myManager.addActionPopup(ActionPopupMenuImpl.this); } @@ -153,5 +158,4 @@ public final class ActionPopupMenuImpl extends ApplicationActivationListener.Ada myMenu.setVisible(false); } } - } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeMenuBar.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeMenuBar.java index 56330fa1e648..65ba07c7f920 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeMenuBar.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeMenuBar.java @@ -347,7 +347,7 @@ public class IdeMenuBar extends JMenuBar implements IdeEventQueue.EventDispatche myNewVisibleActions = temp; removeAll(); - final boolean enableMnemonics = !UISettings.getInstance().DISABLE_MNEMONICS; + final boolean enableMnemonics = !UISettings.getInstance().getDisableMnemonics(); for (final AnAction action : myVisibleActions) { add(new ActionMenu(null, ActionPlaces.MAIN_MENU, (ActionGroup)action, myPresentationFactory, enableMnemonics, true)); } @@ -439,7 +439,7 @@ public class IdeMenuBar extends JMenuBar implements IdeEventQueue.EventDispatche } private void updateMnemonicsVisibility() { - final boolean enabled = !UISettings.getInstance().DISABLE_MNEMONICS; + final boolean enabled = !UISettings.getInstance().getDisableMnemonics(); for (int i = 0; i < getMenuCount(); i++) { ((ActionMenu)getMenu(i)).setMnemonicEnabled(enabled); }