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)");
});
}
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);
}
});
}
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;
}
}
Aggregations