Search in sources :

Example 21 with StatusBar

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);
            }
        });
    });
}
Also used : FindModel(com.intellij.find.FindModel) HighlightManager(com.intellij.codeInsight.highlighting.HighlightManager) EditorColorsManager(com.intellij.openapi.editor.colors.EditorColorsManager) StatusBar(com.intellij.openapi.wm.StatusBar) WindowManager(com.intellij.openapi.wm.WindowManager) Project(com.intellij.openapi.project.Project) FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) FindManager(com.intellij.find.FindManager) TextAttributes(com.intellij.openapi.editor.markup.TextAttributes) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) Editor(com.intellij.openapi.editor.Editor) Application(com.intellij.openapi.application.Application) PsiElement(com.intellij.psi.PsiElement)

Example 22 with StatusBar

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();
    });
}
Also used : StatusBar(com.intellij.openapi.wm.StatusBar)

Example 23 with StatusBar

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);
}
Also used : CustomStatusBarWidget(com.intellij.openapi.wm.CustomStatusBarWidget) StatusBar(com.intellij.openapi.wm.StatusBar)

Example 24 with StatusBar

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);
}
Also used : PlaybackRunner(com.intellij.openapi.ui.playback.PlaybackRunner) IdeFrame(com.intellij.openapi.wm.IdeFrame) StatusBar(com.intellij.openapi.wm.StatusBar) PlaybackContext(com.intellij.openapi.ui.playback.PlaybackContext)

Example 25 with StatusBar

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);
    });
}
Also used : FindModel(com.intellij.find.FindModel) HighlightManager(com.intellij.codeInsight.highlighting.HighlightManager) EditorColorsManager(com.intellij.openapi.editor.colors.EditorColorsManager) StatusBar(com.intellij.openapi.wm.StatusBar) WindowManager(com.intellij.openapi.wm.WindowManager) Project(com.intellij.openapi.project.Project) FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) FindManager(com.intellij.find.FindManager) TextAttributes(com.intellij.openapi.editor.markup.TextAttributes) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) Editor(com.intellij.openapi.editor.Editor) Application(com.intellij.openapi.application.Application) PsiElement(com.intellij.psi.PsiElement)

Aggregations

StatusBar (com.intellij.openapi.wm.StatusBar)28 Project (com.intellij.openapi.project.Project)6 Editor (com.intellij.openapi.editor.Editor)4 PsiElement (com.intellij.psi.PsiElement)4 FindManager (com.intellij.find.FindManager)3 FindModel (com.intellij.find.FindModel)3 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 IdeFrame (com.intellij.openapi.wm.IdeFrame)3 WindowManager (com.intellij.openapi.wm.WindowManager)3 CalledInAwt (org.jetbrains.annotations.CalledInAwt)3 HighlightManager (com.intellij.codeInsight.highlighting.HighlightManager)2 Application (com.intellij.openapi.application.Application)2 Document (com.intellij.openapi.editor.Document)2 EditorColorsManager (com.intellij.openapi.editor.colors.EditorColorsManager)2 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)2 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)2 DaemonCodeAnalyzer (com.intellij.codeInsight.daemon.DaemonCodeAnalyzer)1 Printable (com.intellij.execution.testframework.Printable)1 Printer (com.intellij.execution.testframework.Printer)1