List of usage examples for com.intellij.openapi.wm WindowManager getInstance
public static WindowManager getInstance()
From source file:SelectorChapekAction.java
License:Apache License
private void showInfoDialog(String text, AnActionEvent e) { StatusBar statusBar = WindowManager.getInstance() .getStatusBar(DataKeys.PROJECT.getData(e.getDataContext())); if (statusBar != null) { JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(text, MessageType.INFO, null) .setFadeoutTime(10000).createBalloon() .show(RelativePoint.getCenterOf(statusBar.getComponent()), Balloon.Position.atRight); }//from www. jav a 2 s. c om }
From source file:SelectorChapekAction.java
License:Apache License
private void showErrorDialog(String text, AnActionEvent e) { StatusBar statusBar = WindowManager.getInstance() .getStatusBar(DataKeys.PROJECT.getData(e.getDataContext())); if (statusBar != null) { JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(text, MessageType.ERROR, null) .setFadeoutTime(10000).createBalloon() .show(RelativePoint.getCenterOf(statusBar.getComponent()), Balloon.Position.atRight); }//www . j a va 2 s .c o m }
From source file:bazaar4idea.BzrVcs.java
License:Apache License
public void deactivate() { if (!started) { return;//from w w w .ja v a 2 s. co m } if (myRootTracker != null) { myRootTracker.dispose(); myRootTracker = null; } LocalFileSystem lfs = LocalFileSystem.getInstance(); lfs.removeVirtualFileListener(myVirtualFileListener); lfs.unregisterAuxiliaryFileOperationsHandler(myVirtualFileListener); CommandProcessor.getInstance().removeCommandListener(myVirtualFileListener); StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject); if (messageBusConnection != null) { messageBusConnection.disconnect(); } if (changesUpdaterScheduledFuture != null) { changesUpdaterScheduledFuture.cancel(true); } if (statusBar != null) { statusBar.removeCustomIndicationComponent(incomingChangesStatus); statusBar.removeCustomIndicationComponent(outgoingChangesStatus); statusBar.removeCustomIndicationComponent(hgCurrentBranchStatus); } assert m_activationDisposable != null; Disposer.dispose(m_activationDisposable); m_activationDisposable = null; }
From source file:ch.mjava.intellij.PluginHelper.java
License:Apache License
public static void showErrorBalloonWith(String message, DataContext dataContext) { StatusBar statusBar = WindowManager.getInstance().getStatusBar(DataKeys.PROJECT.getData(dataContext)); JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, MessageType.ERROR, null) .setFadeoutTime(5000).createBalloon() .show(RelativePoint.getCenterOf(statusBar.getComponent()), Balloon.Position.atRight); }
From source file:com.android.tools.idea.actions.AndroidMakeProjectAction.java
License:Apache License
@Override protected void buildGradleProject(@NotNull Project project, @NotNull DataContext dataContext) { StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); if (statusBar != null) { // Reset info from the previous runs (if any). statusBar.setInfo(" "); }// w w w . j av a2 s. com ModuleManager moduleManager = ModuleManager.getInstance(project); GradleInvoker.getInstance(project).compileJava(moduleManager.getModules()); }
From source file:com.android.tools.idea.actions.EditMultipleSourcesAction.java
License:Apache License
@Override public void actionPerformed(AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); assert project != null; final Navigatable[] files = e.getData(CommonDataKeys.NAVIGATABLE_ARRAY); assert files != null && files.length > 0; if (files.length > 1) { DefaultListModel listModel = new DefaultListModel(); for (int i = 0; i < files.length; ++i) { assert files[i] instanceof PsiClassNavigation; //noinspection unchecked listModel.add(i, ((PsiClassNavigation) files[i]).getPsiFile()); }/*from w w w.ja v a 2 s .c o m*/ final JBList list = new JBList(listModel); int width = WindowManager.getInstance().getFrame(project).getSize().width; list.setCellRenderer(new GotoFileCellRenderer(width)); JBPopup popup = JBPopupFactory.getInstance().createListPopupBuilder(list).setTitle("Choose Target File") .setItemChoosenCallback(new Runnable() { @Override public void run() { Object selectedValue = list.getSelectedValue(); PsiClassNavigation navigationWrapper = null; for (Navigatable file : files) { if (selectedValue == ((PsiClassNavigation) file).getPsiFile()) { navigationWrapper = (PsiClassNavigation) file; break; } } assert navigationWrapper != null; if (navigationWrapper.canNavigate()) { navigationWrapper.navigate(true); } } }).createPopup(); if (e.getInputEvent().getSource() instanceof ActionButton) { popup.showUnderneathOf((ActionButton) e.getInputEvent().getSource()); } else { popup.showInBestPositionFor(e.getDataContext()); } } else { assert files[0] instanceof PsiClassNavigation; PsiClassNavigation file = (PsiClassNavigation) files[0]; if (file.canNavigate()) { file.navigate(true); } } }
From source file:com.android.tools.idea.editors.hprof.views.ViewBitmapAction.java
License:Apache License
@Override public void actionPerformed(AnActionEvent e) { ClassInstance selectedClassInstance = e.getData(InstancesTreeView.SELECTED_CLASS_INSTANCE); if (selectedClassInstance == null) { return;/*from w w w.ja v a2 s .co m*/ } try { BufferedImage img = BitmapDecoder.getBitmap(new HprofBitmapProvider(selectedClassInstance)); final JComponent comp; if (img != null) { comp = ImageEditorManagerImpl.createImageEditorUI(img); } else { String errorMessage = AndroidBundle.message("android.profiler.hprof.actions.view.bitmap.fail"); comp = new JLabel(errorMessage, Messages.getErrorIcon(), SwingConstants.CENTER); } Project project = e.getData(CommonDataKeys.PROJECT); JBPopup popup = DebuggerUIUtil.createValuePopup(project, comp, null); JFrame frame = WindowManager.getInstance().getFrame(project); Dimension frameSize = frame.getSize(); Dimension size = new Dimension(frameSize.width / 2, frameSize.height / 2); popup.setSize(size); popup.show(new RelativePoint(frame, new Point(size.width / 2, size.height / 2))); } catch (Exception ignored) { } }
From source file:com.android.tools.idea.gradle.actions.MakeGradleProjectAction.java
License:Apache License
@Override protected void doPerform(@NotNull AnActionEvent e, @NotNull Project project) { StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); if (statusBar != null) { // Reset info from the previous runs (if any). statusBar.setInfo(" "); }/*from w ww . ja v a 2 s.co m*/ ModuleManager moduleManager = ModuleManager.getInstance(project); GradleBuildInvoker.getInstance(project).compileJava(moduleManager.getModules(), GradleBuildInvoker.TestCompileType.NONE); }
From source file:com.android.tools.idea.gradle.project.GradleProjectImporter.java
License:Apache License
private static void open(@NotNull final Project newProject) { ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx(); ProjectUtil.updateLastProjectLocation(newProject.getBasePath()); if (WindowManager.getInstance().isFullScreenSupportedInCurrentOS()) { IdeFocusManager instance = IdeFocusManager.findInstance(); IdeFrame lastFocusedFrame = instance.getLastFocusedFrame(); if (lastFocusedFrame instanceof IdeFrameEx) { boolean fullScreen = ((IdeFrameEx) lastFocusedFrame).isInFullScreen(); if (fullScreen) { newProject.putUserData(IdeFrameImpl.SHOULD_OPEN_IN_FULL_SCREEN, Boolean.TRUE); }/* ww w .j a v a 2s . c o m*/ } } projectManager.openProject(newProject); }
From source file:com.android.tools.idea.gradle.project.sync.GradleSyncInvoker.java
License:Apache License
private static boolean isBuildInProgress(@NotNull Project project) { IdeFrame frame = ((WindowManagerEx) WindowManager.getInstance()).findFrameFor(project); StatusBarEx statusBar = frame == null ? null : (StatusBarEx) frame.getStatusBar(); if (statusBar == null) { return false; }/*from ww w .jav a2 s . c o m*/ for (Pair<TaskInfo, ProgressIndicator> backgroundProcess : statusBar.getBackgroundProcesses()) { TaskInfo task = backgroundProcess.getFirst(); if (task instanceof GradleTasksExecutor) { ProgressIndicator second = backgroundProcess.getSecond(); if (second.isRunning()) { return true; } } } return false; }