use of com.intellij.openapi.wm.WindowManager in project intellij-community by JetBrains.
the class StatusBarProgress method start.
@Override
public void start() {
super.start();
//noinspection SSBasedInspection
SwingUtilities.invokeLater(() -> {
if (ApplicationManager.getApplication().isDisposed())
return;
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) {
StatusBar statusBar = windowManager.getStatusBar(project);
if (statusBar != null) {
String info = notNull(statusBar.getInfo(), "");
// initial value
myStatusBar2SavedText.put(statusBar, pair(info, info));
}
}
});
}
use of com.intellij.openapi.wm.WindowManager in project intellij-community by JetBrains.
the class RefreshProgress method updateIndicators.
private void updateIndicators(final boolean start) {
// wrapping in invokeLater here reduces the number of events posted to EDT in case of multiple IDE frames
UIUtil.invokeLaterIfNeeded(() -> {
if (ApplicationManager.getApplication().isDisposed())
return;
WindowManager windowManager = WindowManager.getInstance();
if (windowManager == null)
return;
Project[] projects = ProjectManager.getInstance().getOpenProjects();
if (projects.length == 0)
projects = NULL_ARRAY;
for (Project project : projects) {
StatusBarEx statusBar = (StatusBarEx) windowManager.getStatusBar(project);
if (statusBar != null) {
if (start) {
statusBar.startRefreshIndication(myMessage);
} else {
statusBar.stopRefreshIndication();
}
}
}
});
}
use of com.intellij.openapi.wm.WindowManager in project intellij-community by JetBrains.
the class HighlightUtil method highlightElements.
public static void highlightElements(@NotNull final Collection<? extends PsiElement> elementCollection, @NotNull final String statusBarText) {
if (elementCollection.isEmpty()) {
return;
}
final Application application = ApplicationManager.getApplication();
application.invokeLater(() -> {
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(() -> {
final WindowManager windowManager = WindowManager.getInstance();
final StatusBar statusBar = windowManager.getStatusBar(project);
if (statusBar != null) {
statusBar.setInfo(statusBarText);
}
});
});
}
use of com.intellij.openapi.wm.WindowManager in project intellij-community by JetBrains.
the class HighlightUtils method highlightElements.
public static void highlightElements(@NotNull final Collection<? extends PsiElement> elementCollection) {
if (elementCollection.isEmpty()) {
return;
}
if (elementCollection.contains(null)) {
throw new IllegalArgumentException("Nulls passed in collection: " + elementCollection);
}
final Application application = ApplicationManager.getApplication();
application.invokeLater(() -> {
final PsiElement[] elements = PsiUtilCore.toPsiElementArray(elementCollection);
final PsiElement firstElement = elements[0];
if (ContainerUtil.exists(elements, element -> !element.isValid())) {
return;
}
final Project project = firstElement.getProject();
if (project.isDisposed())
return;
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);
});
}
use of com.intellij.openapi.wm.WindowManager in project google-cloud-intellij by GoogleCloudPlatform.
the class CloudSdkServiceManager method openBackgroundProcessWindow.
/**
* Exposes process window so that installation / dependent processes are explicitly visible.
*/
private void openBackgroundProcessWindow(Project project) {
WindowManager windowManager = WindowManager.getInstance();
StatusBar statusBar = windowManager.getStatusBar(project);
if (statusBar != null && statusBar instanceof StatusBarEx) {
((StatusBarEx) statusBar).setProcessWindowOpen(true);
}
}
Aggregations