List of usage examples for com.intellij.openapi.wm WindowManager getStatusBar
public abstract StatusBar getStatusBar(@NotNull Project project);
From source file:com.echologic.xfiles.RefreshAction.java
License:Open Source License
public void actionPerformed(AnActionEvent event) { log.debug("actionPerformed"); if (filter == null) { log.debug("no filter selected"); return;//from ww w .ja va 2 s .co m } long start = System.currentTimeMillis(); final Project project = (Project) event.getDataContext().getData(DataConstants.PROJECT); CountingFilterListener listener = new CountingFilterListener(); filter.setListener(listener); XFilesContentIterator content = new XFilesContentIterator(project); content.setFilter(filter); content.iterate(); listener.log(); List included = content.getIncluded(); model.clear(); for (Iterator iterator = included.iterator(); iterator.hasNext();) { VirtualFile file = (VirtualFile) iterator.next(); model.addElement(file); } long finish = System.currentTimeMillis(); long delta = finish - start; WindowManager windowManager = WindowManager.getInstance(); StatusBar statusBar = windowManager.getStatusBar(project); statusBar.setInfo(filter.getName() + " filter refreshed in " + delta + "ms; " + content + listener); FileEditorManager editorManager = FileEditorManager.getInstance(project); VirtualFile[] files = editorManager.getSelectedFiles(); if (files != null && files.length > 0) model.setSelectedItem(files[0]); }
From source file:com.googlecode.intelliguard.util.UiUtils.java
License:Apache License
public static void setStatusMessage(final Project project, final String message) { final WindowManager windowManager = WindowManager.getInstance(); final StatusBar statusBar = windowManager.getStatusBar(project); Runnable r = new Runnable() { public void run() { statusBar.setInfo(message);//from w w w. j a v a 2 s . co m } }; ApplicationManager.getApplication().invokeLater(r); }
From source file:com.intellij.debugger.engine.DebugProcessImpl.java
License:Apache License
public void showStatusText(final String text) { if (!myStatusUpdateAlarm.isDisposed()) { myStatusUpdateAlarm.cancelAllRequests(); myStatusUpdateAlarm.addRequest(new Runnable() { @Override//from w ww . jav a 2 s. co m public void run() { final WindowManager wm = WindowManager.getInstance(); if (wm != null) { wm.getStatusBar(myProject).setInfo(text); } } }, 50); } }
From source file:com.siyeh.ig.psiutils.HighlightUtils.java
License:Apache License
public static void highlightElements(@NotNull final Collection<? extends PsiElement> elementCollection) { if (elementCollection.isEmpty()) { return;//w w w .j a va2 s . c om } final Application application = ApplicationManager.getApplication(); application.invokeLater(new Runnable() { public void run() { final PsiElement[] elements = PsiUtilBase.toPsiElementArray(elementCollection); final PsiElement firstElement = elements[0]; if (!firstElement.isValid()) { return; } final Project project = firstElement.getProject(); final FileEditorManager editorManager = FileEditorManager.getInstance(project); final EditorColorsManager editorColorsManager = EditorColorsManager.getInstance(); final Editor editor = editorManager.getSelectedTextEditor(); if (editor == null) { return; } final EditorColorsScheme globalScheme = editorColorsManager.getGlobalScheme(); final TextAttributes textattributes = globalScheme .getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES); final HighlightManager highlightManager = HighlightManager.getInstance(project); highlightManager.addOccurrenceHighlights(editor, elements, textattributes, true, null); final WindowManager windowManager = WindowManager.getInstance(); final StatusBar statusBar = windowManager.getStatusBar(project); statusBar.setInfo(InspectionGadgetsBundle.message("press.escape.to.remove.highlighting.message")); final FindManager findmanager = FindManager.getInstance(project); FindModel findmodel = findmanager.getFindNextModel(); if (findmodel == null) { findmodel = findmanager.getFindInFileModel(); } findmodel.setSearchHighlighters(true); findmanager.setFindWasPerformed(); findmanager.setFindNextModel(findmodel); } }); }
From source file:com.siyeh.ipp.psiutils.HighlightUtil.java
License:Apache License
public static void highlightElements(@NotNull final Collection<? extends PsiElement> elementCollection, @NotNull final String statusBarText) { if (elementCollection.isEmpty()) { return;/*from www .j a v a2 s.com*/ } final Application application = ApplicationManager.getApplication(); application.invokeLater(new Runnable() { public void run() { final PsiElement[] elements = PsiUtilCore.toPsiElementArray(elementCollection); final PsiElement firstElement = elements[0]; if (!firstElement.isValid()) { return; } final Project project = firstElement.getProject(); final FileEditorManager editorManager = FileEditorManager.getInstance(project); final EditorColorsManager editorColorsManager = EditorColorsManager.getInstance(); final Editor editor = editorManager.getSelectedTextEditor(); if (editor == null) { return; } final EditorColorsScheme globalScheme = editorColorsManager.getGlobalScheme(); final TextAttributes textattributes = globalScheme .getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES); final HighlightManager highlightManager = HighlightManager.getInstance(project); highlightManager.addOccurrenceHighlights(editor, elements, textattributes, true, null); final FindManager findmanager = FindManager.getInstance(project); FindModel findmodel = findmanager.getFindNextModel(); if (findmodel == null) { findmodel = findmanager.getFindInFileModel(); } findmodel.setSearchHighlighters(true); findmanager.setFindWasPerformed(); findmanager.setFindNextModel(findmodel); application.invokeLater(new Runnable() { public void run() { final WindowManager windowManager = WindowManager.getInstance(); final StatusBar statusBar = windowManager.getStatusBar(project); if (statusBar != null) { statusBar.setInfo(statusBarText); } } }); } }); }
From source file:de.halirutan.mathematica.actions.HighlightElementAndReferences.java
License:Open Source License
public void actionPerformed(AnActionEvent e) { final Project project = e.getProject(); final FileEditorManager editorManager = FileEditorManager.getInstance(project); final HighlightManager highlightManager = HighlightManager.getInstance(project); final EditorColorsManager editorColorsManager = EditorColorsManager.getInstance(); final Editor editor = editorManager.getSelectedTextEditor(); final EditorColorsScheme globalScheme = editorColorsManager.getGlobalScheme(); final TextAttributes textattributes = globalScheme.getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES); assert editor != null; assert project != null; final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); assert psiFile != null; //region Interesting part where I track down usages PsiElement element = psiFile.findElementAt(editor.getCaretModel().getOffset()); element = (element != null) ? element.getParent() : null; final List<PsiElement> usages = new ArrayList<PsiElement>(); if (element instanceof Symbol) { // usages.add(element); final PsiReference ref = element.getReference(); if (ref != null) { final PsiElement resolve = ref.resolve(); if (resolve != null && resolve instanceof Symbol) { if (!resolve.equals(element)) usages.add(resolve); final Collection<Symbol> symbolsInFile = PsiTreeUtil.findChildrenOfType(psiFile, Symbol.class); for (Symbol symbol : symbolsInFile) { final PsiReference reference = symbol.getReference(); if (reference != null) { final PsiElement resolve1 = reference.resolve(); if (resolve1 != null && !symbol.equals(resolve1) && resolve.equals(resolve1)) { usages.add(symbol); }//from w w w .j a va2 s. com } } } } } //endregion highlightManager.addOccurrenceHighlights(editor, usages.toArray(new PsiElement[usages.size()]), textattributes, false, null); final WindowManager windowManager = WindowManager.getInstance(); final StatusBar statusBar = windowManager.getStatusBar(project); assert statusBar != null; statusBar.setInfo("Press Esc to remove highlighting"); }
From source file:mobi.hsz.idea.gitignore.util.RefreshProgress.java
License:Open Source License
/** Progress start method. */ @Override// w ww.j a v a 2s . c o m public void start() { super.start(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (ApplicationManager.getApplication().isDisposed()) { return; } final WindowManager windowManager = WindowManager.getInstance(); if (windowManager == null) { return; } Project[] projects = ProjectManager.getInstance().getOpenProjects(); if (projects.length == 0) { projects = new Project[] { null }; } for (Project project : projects) { final StatusBarEx statusBar = (StatusBarEx) windowManager.getStatusBar(project); if (statusBar == null) { continue; } statusBar.startRefreshIndication(message); } } }); }
From source file:mobi.hsz.idea.gitignore.util.RefreshProgress.java
License:Open Source License
/** Progress stop method. */ @Override// w w w . j a v a2 s. co m public void stop() { super.stop(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (ApplicationManager.getApplication().isDisposed()) { return; } final WindowManager windowManager = WindowManager.getInstance(); if (windowManager == null) { return; } Project[] projects = ProjectManager.getInstance().getOpenProjects(); if (projects.length == 0) { projects = new Project[] { null }; } for (Project project : projects) { final StatusBarEx statusBar = (StatusBarEx) windowManager.getStatusBar(project); if (statusBar == null) { continue; } statusBar.stopRefreshIndication(); } } }); }