Java Code Examples for com.intellij.openapi.wm.IdeFrame#getWindow()
The following examples show how to use
com.intellij.openapi.wm.IdeFrame#getWindow() .
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: FrameWrapperPeerFactoryImpl.java From consulo with Apache License 2.0 | 5 votes |
private MyJDialog(FrameWrapper owner, @Nullable IdeFrame parent) throws HeadlessException { super(parent == null ? null : parent.getWindow(), null); myOwner = owner; myParent = parent; setGlassPane(new IdeGlassPaneImpl(getRootPane())); getRootPane().putClientProperty("Window.style", "small"); setBackground(UIUtil.getPanelBackground()); MouseGestureManager.getInstance().add(this); setFocusTraversalPolicy(new LayoutFocusTraversalPolicyExt()); setDefaultCloseOperation(DISPOSE_ON_CLOSE); toUIWindow().putUserData(IdeFrame.KEY, this); toUIWindow().addUserDataProvider(this::getData); }
Example 2
Source File: DesktopWindowManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nullable @Override public consulo.ui.Window findVisibleWindow() { IdeFrame[] frames = getAllProjectFrames(); if (frames.length > 0) { return frames[0].getWindow(); } IdeFrame desktopIdeFrame = WelcomeFrameManager.getInstance().getCurrentFrame(); if (desktopIdeFrame == null) { throw new UnsupportedOperationException("Welcome frame not showing. Possible bug?"); } return desktopIdeFrame.getWindow(); }
Example 3
Source File: DesktopWindowWatcher.java From consulo with Apache License 2.0 | 4 votes |
/** * @param project may be null (for example, if no projects are opened) */ @Nullable public final consulo.ui.Window suggestParentWindow(@Nullable final Project project) { synchronized (myLock) { Window window = getFocusedWindowForProject(project); if (window == null) { if (project != null) { IdeFrame frameFor = WindowManagerEx.getInstanceEx().findFrameFor(project); return frameFor == null ? null : frameFor.getWindow(); } else { return null; } } LOG.assertTrue(window.isDisplayable()); LOG.assertTrue(window.isShowing()); while (window != null) { // skip all windows until found forst dialog or frame if (!(window instanceof Dialog) && !(window instanceof Frame)) { window = window.getOwner(); continue; } // skip not visible and disposed/not shown windows if (!window.isDisplayable() || !window.isShowing()) { window = window.getOwner(); continue; } // skip windows that have not associated WindowInfo final WindowInfo info = myWindow2Info.get(TargetAWT.from(window)); if (info == null) { window = window.getOwner(); continue; } if (info.mySuggestAsParent) { return TargetAWT.from(window); } else { window = window.getOwner(); } } return null; } }
Example 4
Source File: DialogWrapperPeerImpl.java From consulo with Apache License 2.0 | 4 votes |
protected DialogWrapperPeerImpl(@Nonnull DialogWrapper wrapper, @Nullable Project project, boolean canBeParent, @Nonnull DialogWrapper.IdeModalityType ideModalityType) { myWrapper = wrapper; myWindowManager = null; Application application = ApplicationManager.getApplication(); if (application != null) { myWindowManager = (DesktopWindowManagerImpl)WindowManager.getInstance(); } consulo.ui.Window window = null; if (myWindowManager != null) { if (project == null) { //noinspection deprecation project = DataManager.getInstance().getDataContext().getData(CommonDataKeys.PROJECT); } myProject = project; window = myWindowManager.suggestParentWindow(project); if (window == null) { consulo.ui.Window focusedWindow = myWindowManager.getMostRecentFocusedWindow(); if (IdeFrameUtil.isRootIdeFrameWindow(focusedWindow)) { window = focusedWindow; } } if (window == null) { IdeFrame[] frames = myWindowManager.getAllProjectFrames(); for (IdeFrame frame : frames) { if (frame.isActive()) { window = frame.getWindow(); break; } } } } Window owner; if (window != null) { owner = TargetAWT.to(window); } else { if (!isHeadless()) { owner = JOptionPane.getRootFrame(); } else { owner = null; } } createDialog(owner, canBeParent, ideModalityType); }