@Override public JComponent createComponent() { UISettings settings = UISettings.getInstance(); initComponent(); DefaultComboBoxModel aModel = new DefaultComboBoxModel( UIUtil.getValidFontNames(Registry.is("ide.settings.appearance.font.family.only"))); myComponent.myFontCombo.setModel(aModel); myComponent.myFontSizeCombo.setModel(new DefaultComboBoxModel(UIUtil.getStandardFontSizes())); myComponent.myPresentationModeFontSize.setModel( new DefaultComboBoxModel(UIUtil.getStandardFontSizes())); myComponent.myFontSizeCombo.setEditable(true); myComponent.myPresentationModeFontSize.setEditable(true); myComponent.myLafComboBox.setModel( new DefaultComboBoxModel(LafManager.getInstance().getInstalledLookAndFeels())); myComponent.myLafComboBox.setRenderer(new LafComboBoxRenderer()); myComponent.myAntialiasingInIDE.setModel(new DefaultComboBoxModel(AntialiasingType.values())); myComponent.myAntialiasingInEditor.setModel( new DefaultComboBoxModel(AntialiasingType.values())); myComponent.myAntialiasingInIDE.setSelectedItem(settings.IDE_AA_TYPE); myComponent.myAntialiasingInEditor.setSelectedItem(settings.EDITOR_AA_TYPE); myComponent.myAntialiasingInIDE.setRenderer(ourListCellRenderer); myComponent.myAntialiasingInEditor.setRenderer(ourListCellRenderer); Dictionary<Integer, JComponent> delayDictionary = new Hashtable<Integer, JComponent>(); delayDictionary.put(new Integer(0), new JLabel("0")); delayDictionary.put(new Integer(1200), new JLabel("1200")); // delayDictionary.put(new Integer(2400), new JLabel("2400")); myComponent.myInitialTooltipDelaySlider.setLabelTable(delayDictionary); UIUtil.setSliderIsFilled(myComponent.myInitialTooltipDelaySlider, Boolean.TRUE); myComponent.myInitialTooltipDelaySlider.setMinimum(0); myComponent.myInitialTooltipDelaySlider.setMaximum(1200); myComponent.myInitialTooltipDelaySlider.setPaintLabels(true); myComponent.myInitialTooltipDelaySlider.setPaintTicks(true); myComponent.myInitialTooltipDelaySlider.setPaintTrack(true); myComponent.myInitialTooltipDelaySlider.setMajorTickSpacing(1200); myComponent.myInitialTooltipDelaySlider.setMinorTickSpacing(100); myComponent.myEnableAlphaModeCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean state = myComponent.myEnableAlphaModeCheckBox.isSelected(); myComponent.myAlphaModeDelayTextField.setEnabled(state); myComponent.myAlphaModeRatioSlider.setEnabled(state); } }); myComponent.myAlphaModeRatioSlider.setSize(100, 50); @SuppressWarnings({"UseOfObsoleteCollectionType"}) Dictionary<Integer, JComponent> dictionary = new Hashtable<Integer, JComponent>(); dictionary.put(new Integer(0), new JLabel("0%")); dictionary.put(new Integer(50), new JLabel("50%")); dictionary.put(new Integer(100), new JLabel("100%")); myComponent.myAlphaModeRatioSlider.setLabelTable(dictionary); UIUtil.setSliderIsFilled(myComponent.myAlphaModeRatioSlider, Boolean.TRUE); myComponent.myAlphaModeRatioSlider.setPaintLabels(true); myComponent.myAlphaModeRatioSlider.setPaintTicks(true); myComponent.myAlphaModeRatioSlider.setPaintTrack(true); myComponent.myAlphaModeRatioSlider.setMajorTickSpacing(50); myComponent.myAlphaModeRatioSlider.setMinorTickSpacing(10); myComponent.myAlphaModeRatioSlider.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { myComponent.myAlphaModeRatioSlider.setToolTipText( myComponent.myAlphaModeRatioSlider.getValue() + "%"); } }); myComponent.myTransparencyPanel.setVisible( WindowManagerEx.getInstanceEx().isAlphaModeSupported()); return myComponent.myPanel; }
private Window updateMaskAndAlpha(Window window) { if (window == null) return window; final WindowManagerEx wndManager = getWndManager(); if (wndManager == null) return window; if (!wndManager.isAlphaModeEnabled(window)) return window; if (myAlpha != myLastAlpha) { wndManager.setAlphaModeRatio(window, myAlpha); myLastAlpha = myAlpha; } if (myMaskProvider != null) { final Dimension size = window.getSize(); Shape mask = myMaskProvider.getMask(size); wndManager.setWindowMask(window, mask); } WindowManagerEx.WindowShadowMode mode = myShadowed ? WindowManagerEx.WindowShadowMode.NORMAL : WindowManagerEx.WindowShadowMode.DISABLED; WindowManagerEx.getInstanceEx().setWindowShadow(window, mode); return window; }
protected DialogWrapperPeerImpl( @NotNull DialogWrapper wrapper, @Nullable Project project, boolean canBeParent, @NotNull DialogWrapper.IdeModalityType ideModalityType) { myWrapper = wrapper; myTypeAheadCallback = myWrapper.isTypeAheadEnabled() ? new ActionCallback() : null; myWindowManager = null; Application application = ApplicationManager.getApplication(); if (application != null && application.hasComponent(WindowManager.class)) { myWindowManager = (WindowManagerEx) WindowManager.getInstance(); } Window window = null; if (myWindowManager != null) { if (project == null) { //noinspection deprecation project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext()); } myProject = project; window = myWindowManager.suggestParentWindow(project); if (window == null) { Window focusedWindow = myWindowManager.getMostRecentFocusedWindow(); if (focusedWindow instanceof IdeFrameImpl) { window = focusedWindow; } } if (window == null) { IdeFrame[] frames = myWindowManager.getAllProjectFrames(); for (IdeFrame frame : frames) { if (frame instanceof IdeFrameImpl && ((IdeFrameImpl) frame).isActive()) { window = (IdeFrameImpl) frame; break; } } } } Window owner; if (window != null) { owner = window; } else { if (!isHeadless()) { owner = JOptionPane.getRootFrame(); } else { owner = null; } } createDialog(owner, canBeParent, ideModalityType); }
private static void setCustomizationSchemaForCurrentProjects() { final Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); for (Project project : openProjects) { final IdeFrameImpl frame = WindowManagerEx.getInstanceEx().getFrame(project); if (frame != null) { frame.updateView(); } } final IdeFrameImpl frame = WindowManagerEx.getInstanceEx().getFrame(null); if (frame != null) { frame.updateView(); } }
/** * @return true if window ancestor of component was most recent focused window and most recent * focused component in that window was descended from component */ public static boolean hasFocus2(Component component) { WindowManagerEx windowManager = WindowManagerEx.getInstanceEx(); Window activeWindow = null; if (windowManager != null) { activeWindow = windowManager.getMostRecentFocusedWindow(); } if (activeWindow == null) { return false; } Component focusedComponent = windowManager.getFocusedComponent(activeWindow); if (focusedComponent == null) { return false; } return SwingUtilities.isDescendingFrom(focusedComponent, component); }
@Override public void reset() { initComponent(); UISettings settings = UISettings.getInstance(); myComponent.myFontCombo.setSelectedItem(settings.FONT_FACE); // todo migrate // myComponent.myAntialiasingCheckBox.setSelected(settings.ANTIALIASING_IN_IDE); // myComponent.myLCDRenderingScopeCombo.setSelectedItem(settings.LCD_RENDERING_SCOPE); myComponent.myAntialiasingInIDE.setSelectedItem(settings.IDE_AA_TYPE); myComponent.myAntialiasingInEditor.setSelectedItem(settings.EDITOR_AA_TYPE); myComponent.myFontSizeCombo.setSelectedItem(Integer.toString(settings.FONT_SIZE)); myComponent.myPresentationModeFontSize.setSelectedItem( Integer.toString(settings.PRESENTATION_MODE_FONT_SIZE)); myComponent.myAnimateWindowsCheckBox.setSelected(settings.ANIMATE_WINDOWS); myComponent.myWindowShortcutsCheckBox.setSelected(settings.SHOW_TOOL_WINDOW_NUMBERS); myComponent.myShowToolStripesCheckBox.setSelected(!settings.HIDE_TOOL_STRIPES); myComponent.myCbDisplayIconsInMenu.setSelected(settings.SHOW_ICONS_IN_MENUS); myComponent.myShowMemoryIndicatorCheckBox.setSelected(settings.SHOW_MEMORY_INDICATOR); myComponent.myAllowMergeButtons.setSelected(settings.ALLOW_MERGE_BUTTONS); myComponent.myCycleScrollingCheckBox.setSelected(settings.CYCLE_SCROLLING); myComponent.myHideIconsInQuickNavigation.setSelected(settings.SHOW_ICONS_IN_QUICK_NAVIGATION); myComponent.myMoveMouseOnDefaultButtonCheckBox.setSelected( settings.MOVE_MOUSE_ON_DEFAULT_BUTTON); myComponent.myHideNavigationPopupsCheckBox.setSelected(settings.HIDE_NAVIGATION_ON_FOCUS_LOSS); myComponent.myAltDNDCheckBox.setSelected(settings.DND_WITH_PRESSED_ALT_ONLY); myComponent.myLafComboBox.setSelectedItem(LafManager.getInstance().getCurrentLookAndFeel()); myComponent.myOverrideLAFFonts.setSelected(settings.OVERRIDE_NONIDEA_LAF_FONTS); myComponent.myDisableMnemonics.setSelected(settings.DISABLE_MNEMONICS); myComponent.myUseSmallLabelsOnTabs.setSelected(settings.USE_SMALL_LABELS_ON_TABS); myComponent.myWidescreenLayoutCheckBox.setSelected(settings.WIDESCREEN_SUPPORT); myComponent.myLeftLayoutCheckBox.setSelected(settings.LEFT_HORIZONTAL_SPLIT); myComponent.myRightLayoutCheckBox.setSelected(settings.RIGHT_HORIZONTAL_SPLIT); myComponent.myNavigateToPreviewCheckBox.setSelected(settings.NAVIGATE_TO_PREVIEW); myComponent.myNavigateToPreviewCheckBox.setVisible(false); // disabled for a while myComponent.myColorBlindnessPanel.setColorBlindness(settings.COLOR_BLINDNESS); myComponent.myDisableMnemonicInControlsCheckBox.setSelected( settings.DISABLE_MNEMONICS_IN_CONTROLS); boolean alphaModeEnabled = WindowManagerEx.getInstanceEx().isAlphaModeSupported(); if (alphaModeEnabled) { myComponent.myEnableAlphaModeCheckBox.setSelected(settings.ENABLE_ALPHA_MODE); } else { myComponent.myEnableAlphaModeCheckBox.setSelected(false); } myComponent.myEnableAlphaModeCheckBox.setEnabled(alphaModeEnabled); myComponent.myAlphaModeDelayTextField.setText(Integer.toString(settings.ALPHA_MODE_DELAY)); myComponent.myAlphaModeDelayTextField.setEnabled( alphaModeEnabled && settings.ENABLE_ALPHA_MODE); int ratio = (int) (settings.ALPHA_MODE_RATIO * 100f); myComponent.myAlphaModeRatioSlider.setValue(ratio); myComponent.myAlphaModeRatioSlider.setToolTipText(ratio + "%"); myComponent.myAlphaModeRatioSlider.setEnabled(alphaModeEnabled && settings.ENABLE_ALPHA_MODE); myComponent.myInitialTooltipDelaySlider.setValue(Registry.intValue("ide.tooltip.initialDelay")); myComponent.updateCombo(); }
public boolean value(final Project project) { final Component focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent(project); boolean fromQuickSearch = focusedComponent != null && focusedComponent.getParent() instanceof ChooseByNameBase.JPanelProvider; return !fromQuickSearch && LookupManager.getInstance(project).getActiveLookup() == null; }
private boolean noIntersections(Rectangle bounds) { Window owner = SwingUtilities.getWindowAncestor(myComponent); Window popup = SwingUtilities.getWindowAncestor(myTipComponent); Window focus = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow(); if (focus == owner.getOwner()) { focus = null; // do not check intersection with parent } boolean focused = SystemInfo.isWindows || owner.isFocused(); for (Window other : owner.getOwnedWindows()) { if (!focused && !SystemInfo.isWindows) { focused = other.isFocused(); } if (popup != other && other.isVisible() && bounds.x + 10 >= other.getX() && bounds.intersects(other.getBounds())) { return false; } if (focus == other) { focus = null; // already checked } } return focused && (focus == owner || focus == null || !owner.getBounds().intersects(focus.getBounds())); }
@Override public ActionCallback show() { LOG.assertTrue( EventQueue.isDispatchThread(), "Access is allowed from event dispatch thread only"); if (myTypeAheadCallback != null) { IdeFocusManager.getInstance(myProject).typeAheadUntil(myTypeAheadCallback); } LOG.assertTrue( EventQueue.isDispatchThread(), "Access is allowed from event dispatch thread only"); final ActionCallback result = new ActionCallback(); final AnCancelAction anCancelAction = new AnCancelAction(); final JRootPane rootPane = getRootPane(); anCancelAction.registerCustomShortcutSet( new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)), rootPane); myDisposeActions.add( new Runnable() { @Override public void run() { anCancelAction.unregisterCustomShortcutSet(rootPane); } }); if (!myCanBeParent && myWindowManager != null) { myWindowManager.doNotSuggestAsParent(myDialog.getWindow()); } final CommandProcessorEx commandProcessor = ApplicationManager.getApplication() != null ? (CommandProcessorEx) CommandProcessor.getInstance() : null; final boolean appStarted = commandProcessor != null; if (myDialog.isModal() && !isProgressDialog()) { if (appStarted) { commandProcessor.enterModal(); LaterInvocator.enterModal(myDialog); } } if (appStarted) { hidePopupsIfNeeded(); } try { myDialog.show(); } finally { if (myDialog.isModal() && !isProgressDialog()) { if (appStarted) { commandProcessor.leaveModal(); LaterInvocator.leaveModal(myDialog); } } myDialog.getFocusManager().doWhenFocusSettlesDown(result.createSetDoneRunnable()); } return result; }
private static void setCustomizationSchemaForCurrentProjects() { final Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); for (Project project : openProjects) { final IdeFrameImpl frame = WindowManagerEx.getInstanceEx().getFrame(project); if (frame != null) { frame.updateView(); } // final FavoritesManager favoritesView = FavoritesManager.getInstance(project); // final String[] availableFavoritesLists = favoritesView.getAvailableFavoritesLists(); // for (String favoritesList : availableFavoritesLists) { // favoritesView.getFavoritesTreeViewPanel(favoritesList).updateTreePopupHandler(); // } } final IdeFrameImpl frame = WindowManagerEx.getInstanceEx().getFrame(null); if (frame != null) { frame.updateView(); } }
private boolean showAlreadyChecking() { final IdeFrame frameFor = WindowManagerEx.getInstanceEx().findFrameFor(myProject); if (frameFor != null) { final JComponent component = frameFor.getComponent(); Point point = component.getMousePosition(); if (point == null) { point = new Point((int) (component.getWidth() * 0.7), 0); } SwingUtilities.convertPointToScreen(point, component); JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder("Already checking...", MessageType.WARNING, null) .createBalloon() .show(new RelativePoint(point), Balloon.Position.below); } return false; }
public final void writeExternal(final Element element) { // Save frame bounds final Element frameElement = new Element(FRAME_ELEMENT); element.addContent(frameElement); final Project[] projects = ProjectManager.getInstance().getOpenProjects(); final Project project; if (projects.length > 0) { project = projects[projects.length - 1]; } else { project = null; } final IdeFrameImpl frame = getFrame(project); if (frame != null) { int extendedState = frame.getExtendedState(); if (SystemInfo.isMacOSLion && frame.getPeer() instanceof FramePeer) { // frame.state is not updated by jdk so get it directly from peer extendedState = ((FramePeer) frame.getPeer()).getState(); } boolean usePreviousBounds = extendedState == Frame.MAXIMIZED_BOTH || isFullScreenSupportedInCurrentOS() && WindowManagerEx.getInstanceEx().isFullScreen(frame); Rectangle rectangle = usePreviousBounds ? myFrameBounds : frame.getBounds(); if (rectangle == null) { // frame is out of the screen? rectangle = ScreenUtil.getScreenRectangle(0, 0); } frameElement.setAttribute(X_ATTR, Integer.toString(rectangle.x)); frameElement.setAttribute(Y_ATTR, Integer.toString(rectangle.y)); frameElement.setAttribute(WIDTH_ATTR, Integer.toString(rectangle.width)); frameElement.setAttribute(HEIGHT_ATTR, Integer.toString(rectangle.height)); frameElement.setAttribute(EXTENDED_STATE_ATTR, Integer.toString(extendedState)); // Save default layout final Element layoutElement = new Element(DesktopLayout.TAG); element.addContent(layoutElement); myLayout.writeExternal(layoutElement); } }
protected IdeFrame getFrame(Project project) { final WindowManagerEx windowManagerEx = WindowManagerEx.getInstanceEx(); final IdeFrame frame = windowManagerEx.getFrame(project); LOG.assertTrue(ApplicationManager.getApplication().isUnitTestMode() || frame != null); return frame; }
@Override public boolean isModified() { initComponent(); UISettings settings = UISettings.getInstance(); boolean isModified = false; isModified |= !Comparing.equal(myComponent.myFontCombo.getSelectedItem(), settings.FONT_FACE); isModified |= !Comparing.equal( myComponent.myFontSizeCombo.getEditor().getItem(), Integer.toString(settings.FONT_SIZE)); isModified |= !myComponent.myAntialiasingInIDE.getSelectedItem().equals(settings.IDE_AA_TYPE); isModified |= !myComponent.myAntialiasingInEditor.getSelectedItem().equals(settings.EDITOR_AA_TYPE); isModified |= myComponent.myAnimateWindowsCheckBox.isSelected() != settings.ANIMATE_WINDOWS; isModified |= myComponent.myWindowShortcutsCheckBox.isSelected() != settings.SHOW_TOOL_WINDOW_NUMBERS; isModified |= myComponent.myShowToolStripesCheckBox.isSelected() == settings.HIDE_TOOL_STRIPES; isModified |= myComponent.myCbDisplayIconsInMenu.isSelected() != settings.SHOW_ICONS_IN_MENUS; isModified |= myComponent.myShowMemoryIndicatorCheckBox.isSelected() != settings.SHOW_MEMORY_INDICATOR; isModified |= myComponent.myAllowMergeButtons.isSelected() != settings.ALLOW_MERGE_BUTTONS; isModified |= myComponent.myCycleScrollingCheckBox.isSelected() != settings.CYCLE_SCROLLING; isModified |= myComponent.myOverrideLAFFonts.isSelected() != settings.OVERRIDE_NONIDEA_LAF_FONTS; isModified |= myComponent.myDisableMnemonics.isSelected() != settings.DISABLE_MNEMONICS; isModified |= myComponent.myDisableMnemonicInControlsCheckBox.isSelected() != settings.DISABLE_MNEMONICS_IN_CONTROLS; isModified |= myComponent.myUseSmallLabelsOnTabs.isSelected() != settings.USE_SMALL_LABELS_ON_TABS; isModified |= myComponent.myWidescreenLayoutCheckBox.isSelected() != settings.WIDESCREEN_SUPPORT; isModified |= myComponent.myLeftLayoutCheckBox.isSelected() != settings.LEFT_HORIZONTAL_SPLIT; isModified |= myComponent.myRightLayoutCheckBox.isSelected() != settings.RIGHT_HORIZONTAL_SPLIT; isModified |= myComponent.myNavigateToPreviewCheckBox.isSelected() != settings.NAVIGATE_TO_PREVIEW; isModified |= myComponent.myColorBlindnessPanel.getColorBlindness() != settings.COLOR_BLINDNESS; isModified |= myComponent.myHideIconsInQuickNavigation.isSelected() != settings.SHOW_ICONS_IN_QUICK_NAVIGATION; isModified |= !Comparing.equal( myComponent.myPresentationModeFontSize.getEditor().getItem(), Integer.toString(settings.PRESENTATION_MODE_FONT_SIZE)); isModified |= myComponent.myMoveMouseOnDefaultButtonCheckBox.isSelected() != settings.MOVE_MOUSE_ON_DEFAULT_BUTTON; isModified |= myComponent.myHideNavigationPopupsCheckBox.isSelected() != settings.HIDE_NAVIGATION_ON_FOCUS_LOSS; isModified |= myComponent.myAltDNDCheckBox.isSelected() != settings.DND_WITH_PRESSED_ALT_ONLY; isModified |= !Comparing.equal( myComponent.myLafComboBox.getSelectedItem(), LafManager.getInstance().getCurrentLookAndFeel()); if (WindowManagerEx.getInstanceEx().isAlphaModeSupported()) { isModified |= myComponent.myEnableAlphaModeCheckBox.isSelected() != settings.ENABLE_ALPHA_MODE; int delay = -1; try { delay = Integer.parseInt(myComponent.myAlphaModeDelayTextField.getText()); } catch (NumberFormatException ignored) { } if (delay != -1) { isModified |= delay != settings.ALPHA_MODE_DELAY; } float ratio = myComponent.myAlphaModeRatioSlider.getValue() / 100f; isModified |= ratio != settings.ALPHA_MODE_RATIO; } int tooltipDelay = -1; tooltipDelay = myComponent.myInitialTooltipDelaySlider.getValue(); isModified |= tooltipDelay != Registry.intValue("ide.tooltip.initialDelay"); return isModified; }
@Override public void apply() { initComponent(); UISettings settings = UISettings.getInstance(); int _fontSize = getIntValue(myComponent.myFontSizeCombo, settings.FONT_SIZE); int _presentationFontSize = getIntValue(myComponent.myPresentationModeFontSize, settings.PRESENTATION_MODE_FONT_SIZE); boolean shouldUpdateUI = false; String _fontFace = (String) myComponent.myFontCombo.getSelectedItem(); LafManager lafManager = LafManager.getInstance(); if (_fontSize != settings.FONT_SIZE || !settings.FONT_FACE.equals(_fontFace)) { settings.FONT_SIZE = _fontSize; settings.FONT_FACE = _fontFace; shouldUpdateUI = true; } if (_presentationFontSize != settings.PRESENTATION_MODE_FONT_SIZE) { settings.PRESENTATION_MODE_FONT_SIZE = _presentationFontSize; shouldUpdateUI = true; } if (!myComponent.myAntialiasingInIDE.getSelectedItem().equals(settings.IDE_AA_TYPE)) { settings.IDE_AA_TYPE = (AntialiasingType) myComponent.myAntialiasingInIDE.getSelectedItem(); shouldUpdateUI = true; } if (!myComponent.myAntialiasingInEditor.getSelectedItem().equals(settings.EDITOR_AA_TYPE)) { settings.EDITOR_AA_TYPE = (AntialiasingType) myComponent.myAntialiasingInEditor.getSelectedItem(); shouldUpdateUI = true; } settings.ANIMATE_WINDOWS = myComponent.myAnimateWindowsCheckBox.isSelected(); boolean update = settings.SHOW_TOOL_WINDOW_NUMBERS != myComponent.myWindowShortcutsCheckBox.isSelected(); settings.SHOW_TOOL_WINDOW_NUMBERS = myComponent.myWindowShortcutsCheckBox.isSelected(); update |= settings.HIDE_TOOL_STRIPES != !myComponent.myShowToolStripesCheckBox.isSelected(); settings.HIDE_TOOL_STRIPES = !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.ALLOW_MERGE_BUTTONS != myComponent.myAllowMergeButtons.isSelected(); settings.ALLOW_MERGE_BUTTONS = myComponent.myAllowMergeButtons.isSelected(); update |= settings.CYCLE_SCROLLING != myComponent.myCycleScrollingCheckBox.isSelected(); settings.CYCLE_SCROLLING = myComponent.myCycleScrollingCheckBox.isSelected(); if (settings.OVERRIDE_NONIDEA_LAF_FONTS != myComponent.myOverrideLAFFonts.isSelected()) { shouldUpdateUI = true; } settings.OVERRIDE_NONIDEA_LAF_FONTS = myComponent.myOverrideLAFFonts.isSelected(); settings.MOVE_MOUSE_ON_DEFAULT_BUTTON = myComponent.myMoveMouseOnDefaultButtonCheckBox.isSelected(); settings.HIDE_NAVIGATION_ON_FOCUS_LOSS = myComponent.myHideNavigationPopupsCheckBox.isSelected(); settings.DND_WITH_PRESSED_ALT_ONLY = myComponent.myAltDNDCheckBox.isSelected(); update |= settings.DISABLE_MNEMONICS != myComponent.myDisableMnemonics.isSelected(); settings.DISABLE_MNEMONICS = myComponent.myDisableMnemonics.isSelected(); update |= settings.USE_SMALL_LABELS_ON_TABS != myComponent.myUseSmallLabelsOnTabs.isSelected(); settings.USE_SMALL_LABELS_ON_TABS = myComponent.myUseSmallLabelsOnTabs.isSelected(); update |= settings.WIDESCREEN_SUPPORT != myComponent.myWidescreenLayoutCheckBox.isSelected(); settings.WIDESCREEN_SUPPORT = myComponent.myWidescreenLayoutCheckBox.isSelected(); update |= settings.LEFT_HORIZONTAL_SPLIT != myComponent.myLeftLayoutCheckBox.isSelected(); settings.LEFT_HORIZONTAL_SPLIT = myComponent.myLeftLayoutCheckBox.isSelected(); update |= settings.RIGHT_HORIZONTAL_SPLIT != myComponent.myRightLayoutCheckBox.isSelected(); settings.RIGHT_HORIZONTAL_SPLIT = myComponent.myRightLayoutCheckBox.isSelected(); update |= settings.NAVIGATE_TO_PREVIEW != (myComponent.myNavigateToPreviewCheckBox.isVisible() && myComponent.myNavigateToPreviewCheckBox.isSelected()); settings.NAVIGATE_TO_PREVIEW = myComponent.myNavigateToPreviewCheckBox.isSelected(); ColorBlindness blindness = myComponent.myColorBlindnessPanel.getColorBlindness(); boolean updateEditorScheme = false; if (settings.COLOR_BLINDNESS != blindness) { settings.COLOR_BLINDNESS = blindness; update = true; ComponentsPackage.getStateStore(ApplicationManager.getApplication()) .reloadState(DefaultColorSchemesManager.class); updateEditorScheme = true; } update |= settings.DISABLE_MNEMONICS_IN_CONTROLS != myComponent.myDisableMnemonicInControlsCheckBox.isSelected(); settings.DISABLE_MNEMONICS_IN_CONTROLS = myComponent.myDisableMnemonicInControlsCheckBox.isSelected(); update |= settings.SHOW_ICONS_IN_QUICK_NAVIGATION != myComponent.myHideIconsInQuickNavigation.isSelected(); settings.SHOW_ICONS_IN_QUICK_NAVIGATION = myComponent.myHideIconsInQuickNavigation.isSelected(); if (!Comparing.equal( myComponent.myLafComboBox.getSelectedItem(), lafManager.getCurrentLookAndFeel())) { final UIManager.LookAndFeelInfo lafInfo = (UIManager.LookAndFeelInfo) myComponent.myLafComboBox.getSelectedItem(); if (lafManager.checkLookAndFeel(lafInfo)) { update = shouldUpdateUI = true; final boolean wasDarcula = UIUtil.isUnderDarcula(); lafManager.setCurrentLookAndFeel(lafInfo); //noinspection SSBasedInspection SwingUtilities.invokeLater( new Runnable() { @Override public void run() { if (UIUtil.isUnderDarcula()) { DarculaInstaller.install(); } else if (wasDarcula) { DarculaInstaller.uninstall(); } } }); } } if (shouldUpdateUI) { lafManager.updateUI(); } if (WindowManagerEx.getInstanceEx().isAlphaModeSupported()) { int delay = -1; try { delay = Integer.parseInt(myComponent.myAlphaModeDelayTextField.getText()); } catch (NumberFormatException ignored) { } float ratio = myComponent.myAlphaModeRatioSlider.getValue() / 100f; if (myComponent.myEnableAlphaModeCheckBox.isSelected() != settings.ENABLE_ALPHA_MODE || delay != -1 && delay != settings.ALPHA_MODE_DELAY || ratio != settings.ALPHA_MODE_RATIO) { update = true; settings.ENABLE_ALPHA_MODE = myComponent.myEnableAlphaModeCheckBox.isSelected(); settings.ALPHA_MODE_DELAY = delay; settings.ALPHA_MODE_RATIO = ratio; } } int tooltipDelay = Math.min(myComponent.myInitialTooltipDelaySlider.getValue(), 5000); if (tooltipDelay != Registry.intValue("ide.tooltip.initialDelay")) { update = true; Registry.get("ide.tooltip.initialDelay").setValue(tooltipDelay); } if (update) { settings.fireUISettingsChanged(); } myComponent.updateCombo(); EditorUtil.reinitSettings(); if (updateEditorScheme) { EditorColorsManagerImpl.schemeChangedOrSwitched(); } }
private static WindowManagerEx getWndManager() { return ApplicationManagerEx.getApplicationEx() != null ? WindowManagerEx.getInstanceEx() : null; }