Search in sources :

Example 16 with StatusBar

use of com.intellij.openapi.wm.StatusBar in project intellij-community by JetBrains.

the class ExecutionHandler method processRunningAnt.

private static void processRunningAnt(final ProgressIndicator progress, final AntProcessHandler handler, final AntBuildMessageView errorView, final AntBuildFileBase buildFile, final long startTime, final AntBuildListener antBuildListener) {
    final Project project = buildFile.getProject();
    final StatusBar statusbar = WindowManager.getInstance().getStatusBar(project);
    if (statusbar != null) {
        statusbar.setInfo(AntBundle.message("ant.build.started.status.message"));
    }
    final CheckCancelTask checkCancelTask = new CheckCancelTask(progress, handler);
    checkCancelTask.start(0);
    final OutputParser parser = OutputParser2.attachParser(project, handler, errorView, progress, buildFile);
    handler.addProcessListener(new ProcessAdapter() {

        private final StringBuilder myUnprocessedStdErr = new StringBuilder();

        public void onTextAvailable(ProcessEvent event, Key outputType) {
            if (outputType == ProcessOutputTypes.STDERR) {
                final String text = event.getText();
                synchronized (myUnprocessedStdErr) {
                    myUnprocessedStdErr.append(text);
                }
            }
        }

        public void processTerminated(ProcessEvent event) {
            final long buildTime = System.currentTimeMillis() - startTime;
            checkCancelTask.cancel();
            parser.setStopped(true);
            final OutputPacketProcessor dispatcher = handler.getErr().getEventsDispatcher();
            try {
                if (event.getExitCode() != 0) {
                    // in case process exits abnormally, provide all unprocessed stderr content
                    final String unprocessed;
                    synchronized (myUnprocessedStdErr) {
                        unprocessed = myUnprocessedStdErr.toString();
                        myUnprocessedStdErr.setLength(0);
                    }
                    if (!unprocessed.isEmpty()) {
                        dispatcher.processOutput(new Printable() {

                            public void printOn(Printer printer) {
                                errorView.outputError(unprocessed, AntBuildMessageView.PRIORITY_ERR);
                            }
                        });
                    }
                } else {
                    synchronized (myUnprocessedStdErr) {
                        myUnprocessedStdErr.setLength(0);
                    }
                }
            } finally {
                errorView.buildFinished(progress != null && progress.isCanceled(), buildTime, antBuildListener, dispatcher);
            }
        }
    });
    handler.startNotify();
}
Also used : Project(com.intellij.openapi.project.Project) Printable(com.intellij.execution.testframework.Printable) Printer(com.intellij.execution.testframework.Printer) StatusBar(com.intellij.openapi.wm.StatusBar) Key(com.intellij.openapi.util.Key) OutputPacketProcessor(com.intellij.lang.ant.segments.OutputPacketProcessor)

Example 17 with StatusBar

use of com.intellij.openapi.wm.StatusBar in project android by JetBrains.

the class MakeGradleProjectAction method doPerform.

@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(" ");
    }
    ModuleManager moduleManager = ModuleManager.getInstance(project);
    GradleBuildInvoker.getInstance(project).compileJava(moduleManager.getModules(), GradleBuildInvoker.TestCompileType.NONE);
}
Also used : ModuleManager(com.intellij.openapi.module.ModuleManager) StatusBar(com.intellij.openapi.wm.StatusBar)

Example 18 with StatusBar

use of com.intellij.openapi.wm.StatusBar in project intellij-plugins by JetBrains.

the class ActiveBuildConfigurationWidget method showOrHideWidget.

private void showOrHideWidget(boolean forceRemove) {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
    if (statusBar == null) {
        return;
    }
    boolean showWidget = !forceRemove && shouldShowWidget();
    if (showWidget) {
        if (myWidget == null) {
            myWidget = new MyWidget(myProject);
            statusBar.addWidget(myWidget, MyWidget.getAnchor());
        }
    } else {
        if (myWidget != null) {
            statusBar.removeWidget(myWidget.ID());
            myWidget = null;
        }
    }
}
Also used : StatusBar(com.intellij.openapi.wm.StatusBar)

Example 19 with StatusBar

use of com.intellij.openapi.wm.StatusBar in project ideavim by JetBrains.

the class VimPlugin method showMessage.

public static void showMessage(@Nullable String msg) {
    ProjectManager pm = ProjectManager.getInstance();
    Project[] projects = pm.getOpenProjects();
    for (Project project : projects) {
        StatusBar bar = WindowManager.getInstance().getStatusBar(project);
        if (bar != null) {
            if (msg == null || msg.length() == 0) {
                bar.setInfo("");
            } else {
                bar.setInfo("VIM - " + msg);
            }
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) StatusBar(com.intellij.openapi.wm.StatusBar) ProjectManager(com.intellij.openapi.project.ProjectManager)

Example 20 with StatusBar

use of com.intellij.openapi.wm.StatusBar in project intellij-community by JetBrains.

the class StatusBarUpdater method updateStatus.

private void updateStatus() {
    Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor();
    if (editor == null || !editor.getContentComponent().hasFocus()) {
        return;
    }
    final Document document = editor.getDocument();
    if (document instanceof DocumentEx && ((DocumentEx) document).isInBulkUpdate())
        return;
    int offset = editor.getCaretModel().getOffset();
    DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject);
    HighlightInfo info = ((DaemonCodeAnalyzerImpl) codeAnalyzer).findHighlightByOffset(document, offset, false, MIN);
    String text = info != null && info.getDescription() != null ? info.getDescription() : "";
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(editor.getContentComponent(), myProject);
    if (statusBar != null && !text.equals(statusBar.getInfo())) {
        statusBar.setInfo(text, "updater");
    }
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx) DaemonCodeAnalyzer(com.intellij.codeInsight.daemon.DaemonCodeAnalyzer) Editor(com.intellij.openapi.editor.Editor) Document(com.intellij.openapi.editor.Document) StatusBar(com.intellij.openapi.wm.StatusBar)

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