use of com.intellij.openapi.wm.StatusBar 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.StatusBar in project intellij-community by JetBrains.
the class StatusBarProgress method stop.
@Override
public void stop() {
super.stop();
//noinspection SSBasedInspection
SwingUtilities.invokeLater(() -> {
for (StatusBar statusBar : myStatusBar2SavedText.keySet()) {
String textToRestore = updateRestoreText(statusBar);
statusBar.setInfo(textToRestore);
}
myStatusBar2SavedText.clear();
});
}
use of com.intellij.openapi.wm.StatusBar in project intellij-community by JetBrains.
the class ActionMacroManager method startRecording.
public void startRecording(String macroName) {
LOG.assertTrue(!myIsRecording);
myIsRecording = true;
myRecordingMacro = new ActionMacro(macroName);
final StatusBar statusBar = WindowManager.getInstance().getIdeFrame(null).getStatusBar();
myWidget = new Widget(statusBar);
statusBar.addWidget(myWidget);
}
use of com.intellij.openapi.wm.StatusBar in project intellij-community by JetBrains.
the class ActionMacroManager method playbackMacro.
private void playbackMacro(ActionMacro macro) {
final IdeFrame frame = WindowManager.getInstance().getIdeFrame(null);
assert frame != null;
StringBuffer script = new StringBuffer();
ActionMacro.ActionDescriptor[] actions = macro.getActions();
for (ActionMacro.ActionDescriptor each : actions) {
each.generateTo(script);
}
final PlaybackRunner runner = new PlaybackRunner(script.toString(), new PlaybackRunner.StatusCallback.Edt() {
@Override
public void messageEdt(PlaybackContext context, String text, Type type) {
if (type == Type.message || type == Type.error) {
StatusBar statusBar = frame.getStatusBar();
if (statusBar != null) {
if (context != null) {
text = "Line " + context.getCurrentLine() + ": " + text;
}
statusBar.setInfo(text);
}
}
}
}, Registry.is("actionSystem.playback.useDirectActionCall"), true, Registry.is("actionSystem.playback.useTypingTargets"));
myIsPlaying = true;
runner.run().doWhenDone(() -> {
StatusBar statusBar = frame.getStatusBar();
statusBar.setInfo("Script execution finished");
}).doWhenProcessed(() -> myIsPlaying = false);
}
use of com.intellij.openapi.wm.StatusBar 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);
});
}
Aggregations