com.intellij.openapi.wm.ex.WindowManagerEx Java Examples
The following examples show how to use
com.intellij.openapi.wm.ex.WindowManagerEx.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LafManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
private static void fireUpdate() { UISettings.getInstance().fireUISettingsChanged(); EditorFactory.getInstance().refreshAllEditors(); Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); for (Project openProject : openProjects) { FileStatusManager.getInstance(openProject).fileStatusesChanged(); DaemonCodeAnalyzer.getInstance(openProject).restart(); } for (IdeFrame frame : WindowManagerEx.getInstanceEx().getAllProjectFrames()) { if (frame instanceof IdeFrameEx) { ((IdeFrameEx)frame).updateView(); } } ActionToolbarImpl.updateAllToolbarsImmediately(); }
Example #2
Source File: AbstractExpandableItemsHandler.java From consulo with Apache License 2.0 | 6 votes |
private boolean noIntersections(Rectangle bounds) { Window owner = SwingUtilities.getWindowAncestor(myComponent); Window popup = SwingUtilities.getWindowAncestor(myTipComponent); Window focus = TargetAWT.to(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())); }
Example #3
Source File: KeyboardInternationalizationNotificationManager.java From consulo with Apache License 2.0 | 6 votes |
@Override public void hyperlinkUpdate(@Nonnull Notification notification, @Nonnull HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { final String description = event.getDescription(); if ("enable".equals(description)) { KeyboardSettingsExternalizable.getInstance().setNonEnglishKeyboardSupportEnabled(true); } else if ("settings".equals(description)) { final ShowSettingsUtil util = ShowSettingsUtil.getInstance(); IdeFrame ideFrame = WindowManagerEx.getInstanceEx().findFrameFor(null); //util.editConfigurable((JFrame)ideFrame, new StatisticsConfigurable(true)); util.showSettingsDialog(ideFrame.getProject(), KeymapPanel.class); } NotificationsConfiguration.getNotificationsConfiguration().changeSettings(LOCALIZATION_GROUP_DISPLAY_ID, NotificationDisplayType.NONE, false, false); notification.expire(); } }
Example #4
Source File: KeyboardInternationalizationNotificationManager.java From consulo with Apache License 2.0 | 6 votes |
public static Notification createNotification(@Nonnull final String groupDisplayId, @Nullable NotificationListener listener) { final String productName = ApplicationNamesInfo.getInstance().getProductName(); Window recentFocusedWindow = TargetAWT.to(WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow()); String text = "<html>We have found out that you are using a non-english keyboard layout. You can <a href='enable'>enable</a> smart layout support for " + KeyboardSettingsExternalizable.getDisplayLanguageNameForComponent(recentFocusedWindow) + " language." + "You can change this option in the settings of " + productName + " <a href='settings'>more...</a></html>"; String title = "Enable smart keyboard internalization for " + productName + "."; return new Notification(groupDisplayId, title, text, NotificationType.INFORMATION, listener); }
Example #5
Source File: KeyboardInternationalizationNotificationManager.java From consulo with Apache License 2.0 | 6 votes |
public static void showNotification() { if (notificationHasBeenShown) { return; } consulo.ui.Window window = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow(); if(!KeyboardSettingsExternalizable.isSupportedKeyboardLayout(TargetAWT.to(window))) { return; } MyNotificationListener listener = new MyNotificationListener(); Notifications.Bus.notify(createNotification(LOCALIZATION_GROUP_DISPLAY_ID, listener)); notificationHasBeenShown = true; }
Example #6
Source File: AbstractPopup.java From consulo with Apache License 2.0 | 6 votes |
private Window updateMaskAndAlpha(Window window) { if (window == null) return null; if (!window.isDisplayable() || !window.isShowing()) 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; }
Example #7
Source File: IJSwingUtilities.java From consulo with Apache License 2.0 | 6 votes |
/** * @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 = TargetAWT.to(windowManager.getMostRecentFocusedWindow()); } if(activeWindow==null){ return false; } Component focusedComponent = windowManager.getFocusedComponent(activeWindow); if (focusedComponent == null) { return false; } return SwingUtilities.isDescendingFrom(focusedComponent, component); }
Example #8
Source File: IdeMenuBar.java From consulo with Apache License 2.0 | 6 votes |
public IdeMenuBar(ActionManager actionManager, DataManager dataManager) { myActionManager = actionManager; myTimerListener = new MyTimerListener(); myVisibleActions = new ArrayList<AnAction>(); myNewVisibleActions = new ArrayList<AnAction>(); myPresentationFactory = new MenuItemPresentationFactory(); myDataManager = dataManager; if (WindowManagerEx.getInstanceEx().isFloatingMenuBarSupported()) { myAnimator = new MyAnimator(); myActivationWatcher = new Timer(100, new MyActionListener()); myClockPanel = new ClockPanel(); myButton = new MyExitFullScreenButton(); add(myClockPanel); add(myButton); addPropertyChangeListener(WindowManagerEx.FULL_SCREEN, evt -> updateState()); addMouseListener(new MyMouseListener()); } else { myAnimator = null; myActivationWatcher = null; myClockPanel = null; myButton = null; } }
Example #9
Source File: WelcomePopupAction.java From consulo with Apache License 2.0 | 6 votes |
protected void showPopup(DataContext context, ListPopup popup, JComponent contextComponent) { Component focusedComponent = contextComponent != null ? contextComponent : context.getData(PlatformDataKeys.CONTEXT_COMPONENT); if (focusedComponent != null) { if (popup instanceof PopupFactoryImpl.ActionGroupPopup && focusedComponent instanceof JLabel) { ((PopupFactoryImpl.ActionGroupPopup)popup).showUnderneathOfLabel((JLabel)focusedComponent); } else { popup.showUnderneathOf(focusedComponent); } } else { Rectangle r; int x; int y; focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent((Project)null); r = WindowManagerEx.getInstanceEx().getScreenBounds(); x = r.x + r.width / 2; y = r.y + r.height / 2; Point point = new Point(x, y); SwingUtilities.convertPointToScreen(point, focusedComponent.getParent()); popup.showInScreenCoordinates(focusedComponent.getParent(), point); } }
Example #10
Source File: DesktopToolWindowManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
private EditorsSplitters getSplittersToFocus() { WindowManagerEx windowManager = (WindowManagerEx)myWindowManager.get(); Window activeWindow = TargetAWT.to(windowManager.getMostRecentFocusedWindow()); if (activeWindow instanceof DesktopFloatingDecorator) { IdeFocusManager ideFocusManager = IdeFocusManager.findInstanceByComponent(activeWindow); IdeFrame lastFocusedFrame = ideFocusManager.getLastFocusedFrame(); JComponent frameComponent = lastFocusedFrame != null ? lastFocusedFrame.getComponent() : null; Window lastFocusedWindow = frameComponent != null ? SwingUtilities.getWindowAncestor(frameComponent) : null; activeWindow = ObjectUtil.notNull(lastFocusedWindow, activeWindow); } FileEditorManagerEx fem = FileEditorManagerEx.getInstanceEx(myProject); EditorsSplitters splitters = activeWindow != null ? fem.getSplittersFor(activeWindow) : null; return splitters != null ? splitters : fem.getSplitters(); }
Example #11
Source File: DesktopFloatingDecorator.java From consulo with Apache License 2.0 | 6 votes |
@Override public final void show() { setFocusableWindowState(myInfo.isActive()); super.show(); final UISettings uiSettings = UISettings.getInstance(); if (uiSettings.ENABLE_ALPHA_MODE) { final WindowManagerEx windowManager = WindowManagerEx.getInstanceEx(); windowManager.setAlphaModeEnabled(this, true); if (myInfo.isActive()) { windowManager.setAlphaModeRatio(this, 0.0f); } else { windowManager.setAlphaModeRatio(this, uiSettings.ALPHA_MODE_RATIO); } } paint(getGraphics()); // This prevents annoying flick setFocusableWindowState(true); uiSettings.addUISettingsListener(myUISettingsListener, myDelayAlarm); }
Example #12
Source File: DesktopFloatingDecorator.java From consulo with Apache License 2.0 | 6 votes |
@Override public void uiSettingsChanged(final UISettings uiSettings) { LOG.assertTrue(isDisplayable()); LOG.assertTrue(isShowing()); final WindowManagerEx windowManager = WindowManagerEx.getInstanceEx(); myDelayAlarm.cancelAllRequests(); if (uiSettings.ENABLE_ALPHA_MODE) { if (!myInfo.isActive()) { windowManager.setAlphaModeEnabled(DesktopFloatingDecorator.this, true); windowManager.setAlphaModeRatio(DesktopFloatingDecorator.this, uiSettings.ALPHA_MODE_RATIO); } } else { windowManager.setAlphaModeEnabled(DesktopFloatingDecorator.this, false); } }
Example #13
Source File: ActivateNavigationBarAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(AnActionEvent e) { final Project project = e.getDataContext().getData(CommonDataKeys.PROJECT); if (project != null && UISettings.getInstance().SHOW_NAVIGATION_BAR){ final JFrame frame = WindowManagerEx.getInstance().getFrame(project); final IdeRootPane ideRootPane = ((IdeRootPane)frame.getRootPane()); final NavBarPanel navBarPanel = (NavBarPanel)ideRootPane.findByName(NavBarRootPaneExtension.NAV_BAR).getComponent(); navBarPanel.rebuildAndSelectTail(true); } }
Example #14
Source File: PopupUpdateProcessor.java From consulo with Apache License 2.0 | 5 votes |
@Override public void beforeShown(final LightweightWindowEvent windowEvent) { final Lookup activeLookup = LookupManager.getInstance(myProject).getActiveLookup(); if (activeLookup != null) { activeLookup.addLookupListener(new LookupAdapter() { @Override public void currentItemChanged(LookupEvent event) { if (windowEvent.asPopup().isVisible()) { //was not canceled yet final LookupElement item = event.getItem(); if (item != null) { PsiElement targetElement = CompletionUtil.getTargetElement(item); if (targetElement == null) { targetElement = DocumentationManager.getInstance(myProject).getElementFromLookup(activeLookup.getEditor(), activeLookup.getPsiFile()); } updatePopup(targetElement); //open next } } else { activeLookup.removeLookupListener(this); } } }); } else { final Component focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent(myProject); boolean fromQuickSearch = focusedComponent != null && focusedComponent.getParent() instanceof ChooseByNameBase.JPanelProvider; if (fromQuickSearch) { ChooseByNameBase.JPanelProvider panelProvider = (ChooseByNameBase.JPanelProvider)focusedComponent.getParent(); panelProvider.registerHint(windowEvent.asPopup()); } else if (focusedComponent instanceof JComponent) { HintUpdateSupply supply = HintUpdateSupply.getSupply((JComponent)focusedComponent); if (supply != null) supply.registerHint(windowEvent.asPopup()); } } }
Example #15
Source File: DesktopToolWindowManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
public void projectOpened() { final MyUIManagerPropertyChangeListener uiManagerPropertyListener = new MyUIManagerPropertyChangeListener(); final MyLafManagerListener lafManagerListener = new MyLafManagerListener(); UIManager.addPropertyChangeListener(uiManagerPropertyListener); LafManager.getInstance().addLafManagerListener(lafManagerListener, this); Disposer.register(this, () -> { UIManager.removePropertyChangeListener(uiManagerPropertyListener); }); WindowManagerEx windowManager = (WindowManagerEx)myWindowManager.get(); myFrame = (DesktopIdeFrameImpl)windowManager.allocateFrame(myProject); myToolWindowPanel = new DesktopToolWindowPanelImpl(myFrame, this); Disposer.register(myProject, getToolWindowPanel()); JFrame jFrame = (JFrame)TargetAWT.to(myFrame.getWindow()); ((IdeRootPane)jFrame.getRootPane()).setToolWindowsPane(myToolWindowPanel); jFrame.setTitle(FrameTitleBuilder.getInstance().getProjectTitle(myProject)); ((IdeRootPane)jFrame.getRootPane()).updateToolbar(); IdeEventQueue.getInstance().addDispatcher(e -> { if (e instanceof KeyEvent) { dispatchKeyEvent((KeyEvent)e); } if (e instanceof WindowEvent && e.getID() == WindowEvent.WINDOW_LOST_FOCUS && e.getSource() == myFrame) { resetHoldState(); } return false; }, myProject); }
Example #16
Source File: CustomActionsSchema.java From consulo with Apache License 2.0 | 5 votes |
private void initActionIcons() { ActionManager actionManager = ActionManager.getInstance(); for (String actionId : myIconCustomizations.keySet()) { final AnAction anAction = actionManager.getAction(actionId); if (anAction != null) { Icon icon; final String iconPath = myIconCustomizations.get(actionId); if (iconPath != null && new File(FileUtil.toSystemDependentName(iconPath)).exists()) { Image image = null; try { image = ImageLoader.loadFromStream(VfsUtil.convertToURL(VfsUtil.pathToUrl(iconPath)).openStream()); } catch (IOException e) { LOG.debug(e); } icon = image != null ? IconLoader.getIcon(image) : null; } else { icon = AllIcons.Toolbar.Unknown; } if (anAction.getTemplatePresentation() != null) { anAction.getTemplatePresentation().setIcon(icon); anAction.setDefaultIcon(false); } } } final IdeFrameEx frame = WindowManagerEx.getInstanceEx().getIdeFrame(null); if (frame != null) { frame.updateView(); } }
Example #17
Source File: RecentLocationsAction.java From consulo with Apache License 2.0 | 5 votes |
private static void showPopup(@Nonnull Project project, @Nonnull JBPopup popup) { Point savedLocation = DimensionService.getInstance().getLocation(LOCATION_SETTINGS_KEY, project); Window recentFocusedWindow = TargetAWT.to(WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow()); if (savedLocation != null && recentFocusedWindow != null) { popup.showInScreenCoordinates(recentFocusedWindow, savedLocation); } else { popup.showCenteredInCurrentWindow(project); } }
Example #18
Source File: RestoreDefaultLayoutAction.java From consulo with Apache License 2.0 | 5 votes |
public void actionPerformed(AnActionEvent e){ Project project = e.getData(CommonDataKeys.PROJECT); if(project==null){ return; } ToolWindowLayout layout=WindowManagerEx.getInstanceEx().getLayout(); ToolWindowManagerEx.getInstanceEx(project).setLayout(layout); }
Example #19
Source File: StoreDefaultLayoutAction.java From consulo with Apache License 2.0 | 5 votes |
public void actionPerformed(AnActionEvent e){ Project project = e.getData(CommonDataKeys.PROJECT); if(project==null){ return; } ToolWindowLayout layout = ToolWindowManagerEx.getInstanceEx(project).getLayout(); WindowManagerEx.getInstanceEx().setLayout(layout); }
Example #20
Source File: OccurenceNavigatorActionBase.java From consulo with Apache License 2.0 | 5 votes |
@Nullable @RequiredUIAccess private static Component getOccurenceNavigatorFromContext(DataContext dataContext) { Window window = TargetAWT.to(WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow()); if (window != null) { Component component = window.getFocusOwner(); for (Component c = component; c != null; c = c.getParent()) { if (c instanceof OccurenceNavigator) { return c; } } } Project project = dataContext.getData(CommonDataKeys.PROJECT); if (project == null) { return null; } ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project); String id = mgr.getLastActiveToolWindowId(component -> findNavigator(component) != null); if (id == null) { return null; } return (Component)findNavigator(mgr.getToolWindow(id).getComponent()); }
Example #21
Source File: DesktopToolWindowManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
public void projectClosed() { if (myFrame == null) { return; } final String[] ids = getToolWindowIds(); WindowManagerEx windowManager = (WindowManagerEx)myWindowManager.get(); // Remove ToolWindowsPane JFrame window = (JFrame)TargetAWT.to(myFrame.getWindow()); ((IdeRootPane)window.getRootPane()).setToolWindowsPane(null); windowManager.releaseFrame(myFrame); List<FinalizableCommand> commandsList = new ArrayList<>(); appendUpdateToolWindowsPaneCmd(commandsList); // Hide all tool windows for (final String id : ids) { deactivateToolWindowImpl(id, true, commandsList); } // Remove editor component final JComponent editorComponent = getEditorComponent(myProject); appendSetEditorComponentCmd(null, commandsList); execute(commandsList); myFrame = null; }
Example #22
Source File: DockManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
public void setTransparent(boolean transparent) { if (transparent) { WindowManagerEx.getInstanceEx().setAlphaModeEnabled(getFrame(), true); WindowManagerEx.getInstanceEx().setAlphaModeRatio(getFrame(), 0.5f); } else { WindowManagerEx.getInstanceEx().setAlphaModeEnabled(getFrame(), true); WindowManagerEx.getInstanceEx().setAlphaModeRatio(getFrame(), 0f); } }
Example #23
Source File: DesktopFloatingDecorator.java From consulo with Apache License 2.0 | 5 votes |
@Override public final void run() { final WindowManagerEx windowManager = WindowManagerEx.getInstanceEx(); if (isDisplayable() && isShowing()) { windowManager.setAlphaModeRatio(DesktopFloatingDecorator.this, getCurrentAlphaRatio()); } if (myCurrentFrame < TOTAL_FRAME_COUNT) { myCurrentFrame++; myFrameTicker.addRequest(myAnimator, DELAY); } else { myFrameTicker.cancelAllRequests(); } }
Example #24
Source File: KPXStartupDialog.java From IntelliJ-Key-Promoter-X with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void showStartupDialog(Project project) { Window w = WindowManagerEx.getInstanceEx().suggestParentWindow(project); if (ourInstance != null && ourInstance.isVisible()) { ourInstance.dispose(); } ourInstance = (w == null) ? new KPXStartupDialog() : new KPXStartupDialog(w); ourInstance.show(); }
Example #25
Source File: UndoManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
private void commandStarted(UndoConfirmationPolicy undoConfirmationPolicy, boolean recordOriginalReference) { if (myCommandLevel == 0) { myCurrentMerger = new CommandMerger(this, CommandProcessor.getInstance().isUndoTransparentActionInProgress()); if (recordOriginalReference && myProject != null) { Editor editor = null; final Application application = ApplicationManager.getApplication(); if (application.isUnitTestMode() || application.isHeadlessEnvironment()) { editor = DataManager.getInstance().getDataContext().getData(CommonDataKeys.EDITOR); } else { Component component = WindowManagerEx.getInstanceEx().getFocusedComponent(myProject); if (component != null) { editor = DataManager.getInstance().getDataContext(component).getData(CommonDataKeys.EDITOR); } } if (editor != null) { Document document = editor.getDocument(); VirtualFile file = FileDocumentManager.getInstance().getFile(document); if (file != null && file.isValid()) { myOriginatorReference = DocumentReferenceManager.getInstance().create(file); } } } } LOG.assertTrue(myCurrentMerger != null, String.valueOf(myCommandLevel)); myCurrentMerger.setBeforeState(getCurrentState()); myCurrentMerger.mergeUndoConfirmationPolicy(undoConfirmationPolicy); myCommandLevel++; }
Example #26
Source File: ProjectFrameUpdater.java From intellij with Apache License 2.0 | 5 votes |
@Override public void projectOpened(Project project) { if (!enabled.getValue()) { return; } ProjectFrameHelper frameHelper = WindowManagerEx.getInstanceEx().getFrameHelper(project); if (frameHelper != null) { frameHelper.updateView(); } }
Example #27
Source File: IdeHelper.java From idea-php-symfony2-plugin with MIT License | 5 votes |
/** * Find current window element of given project. * Use this to find a component for new dialogs without using JBPopupFactory * * @see com.intellij.ui.popup.AbstractPopup#showCenteredInCurrentWindow */ @Nullable public static Window getWindowComponentFromProject(@NotNull Project project) { WindowManagerEx windowManager = getWindowManager(); if(windowManager == null) { return null; } Window window = null; Component focusedComponent = windowManager.getFocusedComponent(project); if (focusedComponent != null) { Component parent = UIUtil.findUltimateParent(focusedComponent); if (parent instanceof Window) { window = (Window)parent; } } if (window == null) { window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); } if (window != null && window.isShowing()) { return window; } return window; }
Example #28
Source File: WelcomeFrameManager.java From consulo with Apache License 2.0 | 5 votes |
public void showIfNoProjectOpened() { myApplication.invokeLater((DumbAwareRunnable)() -> { WindowManagerEx windowManager = (WindowManagerEx)WindowManager.getInstance(); windowManager.disposeRootFrame(); IdeFrame[] frames = windowManager.getAllProjectFrames(); if (frames.length == 0) { showFrame(); } }, ModalityState.NON_MODAL); }
Example #29
Source File: BaseDataManager.java From consulo with Apache License 2.0 | 5 votes |
public DataContext getDataContextTest(consulo.ui.Component component) { DataContext dataContext = getDataContext(component); Project project = dataContext.getData(CommonDataKeys.PROJECT); Component focusedComponent = ((WindowManagerEx)myWindowManager.get()).getFocusedComponent(project); if (focusedComponent != null) { dataContext = getDataContext(focusedComponent); } return dataContext; }
Example #30
Source File: IdeFrameDecorator.java From consulo with Apache License 2.0 | 5 votes |
protected void notifyFrameComponents(boolean state) { JFrame jFrame = getJFrame(); if (jFrame == null) { return; } jFrame.getRootPane().putClientProperty(WindowManagerEx.FULL_SCREEN, state); jFrame.getJMenuBar().putClientProperty(WindowManagerEx.FULL_SCREEN, state); }