Search in sources :

Example 26 with StatusBar

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

the class XPathEvalAction method highlightResult.

/**
     * <p>Process the result of an XPath query.</p>
     * <p>If the result is a <code>java.util.List</code> object, iterate over all elements and
     * add a highlighter object in the editor if the element is of type <code>PsiElement</code>.
     * <p>If the result is a primitive value (String, Number, Boolean) a message box displaying
     * the value will be displayed. </p>
     *
     * @param editor The editor object to apply the highlighting to
     */
private void highlightResult(XmlElement contextNode, @NotNull final Editor editor, final List<?> list) {
    final Config cfg = XPathAppComponent.getInstance().getConfig();
    int lowestOffset = Integer.MAX_VALUE;
    for (final Object o : list) {
        LOG.assertTrue(o != null, "null element?");
        if (o instanceof PsiElement) {
            final PsiElement element = (PsiElement) o;
            if (element.getContainingFile() == contextNode.getContainingFile()) {
                lowestOffset = highlightElement(editor, element, cfg, lowestOffset);
            }
        } else {
            LOG.info("Don't know what to do with " + o + " in a list context");
        }
        LOG.debug("o = " + o);
    }
    if (cfg.isScrollToFirst() && lowestOffset != Integer.MAX_VALUE) {
        editor.getScrollingModel().scrollTo(editor.offsetToLogicalPosition(lowestOffset), ScrollType.MAKE_VISIBLE);
        editor.getCaretModel().moveToOffset(lowestOffset);
    }
    SwingUtilities.invokeLater(() -> {
        final StatusBar statusBar = WindowManager.getInstance().getStatusBar(editor.getProject());
        final String s = StringUtil.pluralize("match", list.size());
        statusBar.setInfo(list.size() + " XPath " + s + " found (press Escape to remove the highlighting)");
    });
}
Also used : StatusBar(com.intellij.openapi.wm.StatusBar) PsiElement(com.intellij.psi.PsiElement)

Example 27 with StatusBar

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

the class LineEndingsManager method updateStatusBar.

private void updateStatusBar() {
    ApplicationManager.getApplication().invokeLater(() -> {
        IdeFrame frame = WindowManager.getInstance().getIdeFrame(myProject);
        StatusBar statusBar = frame != null ? frame.getStatusBar() : null;
        StatusBarWidget widget = statusBar != null ? statusBar.getWidget("LineSeparator") : null;
        if (widget instanceof LineSeparatorPanel) {
            FileEditorManagerEvent event = new FileEditorManagerEvent(FileEditorManager.getInstance(myProject), null, null, null, null);
            ((LineSeparatorPanel) widget).selectionChanged(event);
        }
    });
}
Also used : StatusBarWidget(com.intellij.openapi.wm.StatusBarWidget) LineSeparatorPanel(com.intellij.openapi.wm.impl.status.LineSeparatorPanel) FileEditorManagerEvent(com.intellij.openapi.fileEditor.FileEditorManagerEvent) IdeFrame(com.intellij.openapi.wm.IdeFrame) StatusBar(com.intellij.openapi.wm.StatusBar)

Example 28 with StatusBar

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

the class HgIncomingOutgoingWidget method deactivate.

@CalledInAwt
public void deactivate() {
    if (!isAlreadyShown)
        return;
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
    if (null != statusBar) {
        statusBar.removeWidget(ID());
        isAlreadyShown = false;
    }
}
Also used : StatusBar(com.intellij.openapi.wm.StatusBar) CalledInAwt(org.jetbrains.annotations.CalledInAwt)

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