Java Code Examples for com.intellij.openapi.util.SystemInfo#isAppleJvm()
The following examples show how to use
com.intellij.openapi.util.SystemInfo#isAppleJvm() .
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: DesktopWindowManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
private Element getFrameState() { // Save frame bounds final Project[] projects = ProjectManager.getInstance().getOpenProjects(); if (projects.length == 0) { return null; } Project project = projects[0]; final IdeFrameEx ideFrame = getIdeFrame(project); if (ideFrame == null) { return null; } JFrame jWindow = (JFrame)TargetAWT.to(ideFrame.getWindow()); int extendedState = updateFrameBounds(jWindow, ideFrame); Rectangle rectangle = FrameBoundsConverter.convertToDeviceSpace(jWindow.getGraphicsConfiguration(), myFrameBounds); final Element frameElement = new Element(FRAME_ELEMENT); 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)); if (!(ideFrame.isInFullScreen() && SystemInfo.isAppleJvm)) { frameElement.setAttribute(EXTENDED_STATE_ATTR, Integer.toString(extendedState)); } return frameElement; }
Example 2
Source File: JBMacMessages.java From consulo with Apache License 2.0 | 4 votes |
private static consulo.ui.Window getForemostWindow(final Window window) { Window _window = null; IdeFocusManager ideFocusManager = IdeFocusManager.getGlobalInstance(); Component focusOwner = IdeFocusManager.findInstance().getFocusOwner(); // Let's ask for a focused component first if (focusOwner != null) { _window = SwingUtilities.getWindowAncestor(focusOwner); } if (_window == null) { // Looks like ide lost focus, let's ask about the last focused component focusOwner = ideFocusManager.getLastFocusedFor(ideFocusManager.getLastFocusedFrame()); if (focusOwner != null) { _window = SwingUtilities.getWindowAncestor(focusOwner); } } if (_window == null) { _window = WindowManager.getInstance().findVisibleFrame(); } if (_window == null && window != null) { // It might be we just has not opened a frame yet. // So let's ask AWT focusOwner = window.getMostRecentFocusOwner(); if (focusOwner != null) { _window = SwingUtilities.getWindowAncestor(focusOwner); } } if (_window != null) { // We have successfully found the window // Let's check that we have not missed a blocker if (ModalityHelper.isModalBlocked(_window)) { _window = ModalityHelper.getModalBlockerFor(_window); } } if (SystemInfo.isAppleJvm && MacUtil.getWindowTitle(_window) == null) { // With Apple JDK we cannot find a window if it does not have a title // Let's show a dialog instead of the message. throw new MacMessageException("MacMessage parent does not have a title."); } while (_window != null && MacUtil.getWindowTitle(_window) == null) { _window = _window.getOwner(); //At least our frame should have a title } while (Registry.is("skip.untitled.windows.for.mac.messages") && _window != null && _window instanceof JDialog && !((JDialog)_window).isModal()) { _window = _window.getOwner(); } return TargetAWT.from(_window); }
Example 3
Source File: MacMessagesImpl.java From consulo with Apache License 2.0 | 4 votes |
private static Window getForemostWindow(final Window window) { Window _window = null; IdeFocusManager ideFocusManager = IdeFocusManager.getGlobalInstance(); Component focusOwner = IdeFocusManager.findInstance().getFocusOwner(); // Let's ask for a focused component first if (focusOwner != null) { _window = SwingUtilities.getWindowAncestor(focusOwner); } if (_window == null) { // Looks like ide lost focus, let's ask about the last focused component focusOwner = ideFocusManager.getLastFocusedFor(ideFocusManager.getLastFocusedFrame()); if (focusOwner != null) { _window = SwingUtilities.getWindowAncestor(focusOwner); } } if (_window == null) { _window = WindowManager.getInstance().findVisibleFrame(); } if (_window == null && window != null) { // It might be we just has not opened a frame yet. // So let's ask AWT focusOwner = window.getMostRecentFocusOwner(); if (focusOwner != null) { _window = SwingUtilities.getWindowAncestor(focusOwner); } } if (_window != null) { // We have successfully found the window // Let's check that we have not missed a blocker if (ModalityHelper.isModalBlocked(_window)) { _window = ModalityHelper.getModalBlockerFor(_window); } } if (SystemInfo.isAppleJvm && MacUtil.getWindowTitle(_window) == null) { // With Apple JDK we cannot find a window if it does not have a title // Let's show a dialog instead of the message. throw new MacMessageException("MacMessage parent does not have a title."); } while (_window != null && MacUtil.getWindowTitle(_window) == null) { _window = _window.getOwner(); //At least our frame should have a title } while (Registry.is("skip.untitled.windows.for.mac.messages") && _window != null && _window instanceof JDialog && !((JDialog)_window).isModal()) { _window = _window.getOwner(); } return _window; }