Java Code Examples for com.intellij.openapi.application.ex.ApplicationManagerEx#getApplicationEx()
The following examples show how to use
com.intellij.openapi.application.ex.ApplicationManagerEx#getApplicationEx() .
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: LoadAllVfsStoredContentsAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(@Nonnull AnActionEvent e) { ApplicationEx application = ApplicationManagerEx.getApplicationEx(); String m = "Started loading content"; LOG.info(m); System.out.println(m); long start = System.currentTimeMillis(); count.set(0); totalSize.set(0); application.runProcessWithProgressSynchronously(() -> { PersistentFS vfs = (PersistentFS)application.getComponent(ManagingFS.class); VirtualFile[] roots = vfs.getRoots(); for (VirtualFile root : roots) { iterateCached(root); } }, "Loading", false, null); long end = System.currentTimeMillis(); String message = "Finished loading content of " + count + " files. " + "Total size=" + StringUtil.formatFileSize(totalSize.get()) + ". " + "Elapsed=" + ((end - start) / 1000) + "sec."; LOG.info(message); System.out.println(message); }
Example 2
Source File: ProjectSettingsForm.java From EclipseCodeFormatter with Apache License 2.0 | 5 votes |
public ListPopup createConfirmation(String title, final String yesText, String noText, final Runnable onYes, final Runnable onNo, int defaultOptionIndex) { final BaseListPopupStep<String> step = new BaseListPopupStep<String>(title, new String[]{yesText, noText}) { @Override public PopupStep onChosen(String selectedValue, final boolean finalChoice) { if (selectedValue.equals(yesText)) { onYes.run(); } else { onNo.run(); } return FINAL_CHOICE; } @Override public void canceled() { } @Override public boolean isMnemonicsNavigationEnabled() { return true; } }; step.setDefaultOptionIndex(defaultOptionIndex); final ApplicationEx app = ApplicationManagerEx.getApplicationEx(); return app == null || !app.isUnitTestMode() ? new ListPopupImpl(step) : new MockConfirmation(step, yesText); }
Example 3
Source File: TabbedPaneWrapper.java From consulo with Apache License 2.0 | 4 votes |
private void assertIsDispatchThread() { final ApplicationEx application = ApplicationManagerEx.getApplicationEx(); if (application != null){ application.assertIsDispatchThread(myTabbedPane.getComponent()); } }
Example 4
Source File: DialogWrapperPeerImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings("deprecation") public void show() { final DialogWrapper dialogWrapper = getDialogWrapper(); boolean isAutoAdjustable = dialogWrapper.isAutoAdjustable(); Point location = null; if (isAutoAdjustable) { pack(); Dimension packedSize = getSize(); Dimension minSize = getMinimumSize(); setSize(Math.max(packedSize.width, minSize.width), Math.max(packedSize.height, minSize.height)); setSize((int)(getWidth() * dialogWrapper.getHorizontalStretch()), (int)(getHeight() * dialogWrapper.getVerticalStretch())); // Restore dialog's size and location myDimensionServiceKey = dialogWrapper.getDimensionKey(); if (myDimensionServiceKey != null) { final Project projectGuess = DataManager.getInstance().getDataContext((Component)this).getData(CommonDataKeys.PROJECT); location = getWindowStateService(projectGuess).getLocation(myDimensionServiceKey); Dimension size = getWindowStateService(projectGuess).getSize(myDimensionServiceKey); if (size != null) { myInitialSize = new Dimension(size); _setSizeForLocation(myInitialSize.width, myInitialSize.height, location); } } if (myInitialSize == null) { myInitialSize = getSize(); } } if (location == null) { location = dialogWrapper.getInitialLocation(); } if (location != null) { setLocation(location); } else { setLocationRelativeTo(getOwner()); } if (isAutoAdjustable) { final Rectangle bounds = getBounds(); ScreenUtil.fitToScreen(bounds); setBounds(bounds); } if (Registry.is("actionSystem.fixLostTyping")) { final IdeEventQueue queue = IdeEventQueue.getInstance(); if (queue != null) { queue.getKeyEventDispatcher().resetState(); } } // Workaround for switching workspaces on dialog show if (SystemInfo.isMac && myProject != null && Registry.is("ide.mac.fix.dialog.showing") && !dialogWrapper.isModalProgress()) { final IdeFrame frame = WindowManager.getInstance().getIdeFrame(myProject.get()); AppIcon.getInstance().requestFocus(frame); } setBackground(UIUtil.getPanelBackground()); final ApplicationEx app = ApplicationManagerEx.getApplicationEx(); if (app != null && !app.isLoaded() && DesktopSplash.BOUNDS != null) { final Point loc = getLocation(); loc.y = DesktopSplash.BOUNDS.y + DesktopSplash.BOUNDS.height; setLocation(loc); } super.show(); }
Example 5
Source File: IdeHelper.java From idea-php-symfony2-plugin with MIT License | 2 votes |
/** * Find a window manager * * @see com.intellij.ui.popup.AbstractPopup */ @Nullable private static WindowManagerEx getWindowManager() { return ApplicationManagerEx.getApplicationEx() != null ? WindowManagerEx.getInstanceEx() : null; }