Java Code Examples for com.intellij.openapi.wm.StatusBar#setInfo()

The following examples show how to use com.intellij.openapi.wm.StatusBar#setInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HighlightingUtil.java    From needsmoredojo with Apache License 2.0 6 votes vote down vote up
public static void highlightElement(Editor editor, @NotNull com.intellij.openapi.project.Project project, @NotNull PsiElement[] elements)
{
    final HighlightManager highlightManager =
            HighlightManager.getInstance(project);
    final EditorColorsManager editorColorsManager =
            EditorColorsManager.getInstance();
    final EditorColorsScheme globalScheme =
            editorColorsManager.getGlobalScheme();
    final TextAttributes textattributes =
            globalScheme.getAttributes(
                    EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES);

    highlightManager.addOccurrenceHighlights(
            editor, elements, textattributes, true, null);
    final WindowManager windowManager = WindowManager.getInstance();
    final StatusBar statusBar = windowManager.getStatusBar(project);
    statusBar.setInfo("Press Esc to remove highlighting");
}
 
Example 2
Source File: StatusBarUpdater.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void updateStatus() {
  if (myProject.isDisposed()) {
    return;
  }

  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, HighlightSeverity.WARNING);
  String text = info != null && info.getDescription() != null ? info.getDescription() : "";

  StatusBar statusBar = WindowManager.getInstance().getStatusBar(editor.getContentComponent(), myProject);
  if (statusBar instanceof StatusBarEx) {
    StatusBarEx barEx = (StatusBarEx)statusBar;
    if (!text.equals(barEx.getInfo())) {
      statusBar.setInfo(text, "updater");
    }
  }
}
 
Example 3
Source File: ActionMenu.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void showDescriptionInStatusBar(boolean isIncluded, Component component, String description) {
  IdeFrame ideFrame = null;
  if (component instanceof Window) {
    ideFrame = TargetAWT.from((Window)component).getUserData(IdeFrame.KEY);
  }

  if (ideFrame == null) {
    ideFrame = DesktopIdeFrameUtil.findIdeFrameFromParent(component);
  }

  StatusBar statusBar;
  if (ideFrame != null && (statusBar = ideFrame.getStatusBar()) != null) {
    statusBar.setInfo(isIncluded ? description : null);
  }
}
 
Example 4
Source File: EscapeHandler.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(Editor editor, DataContext dataContext){
  editor.setHeaderComponent(null);

  Project project = dataContext.getData(CommonDataKeys.PROJECT);
  if (project != null) {
    HighlightManagerImpl highlightManager = (HighlightManagerImpl)HighlightManager.getInstance(project);
    if (highlightManager != null && highlightManager.hideHighlights(editor, HighlightManager.HIDE_BY_ESCAPE | HighlightManager.HIDE_BY_ANY_KEY)) {

      StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
      if (statusBar != null) {
        statusBar.setInfo("");
      }

      FindManager findManager = FindManager.getInstance(project);
      if (findManager != null) {
        FindModel model = findManager.getFindNextModel(editor);
        if (model != null) {
          model.setSearchHighlighters(false);
          findManager.setFindNextModel(model);
        }
      }

      return;
    }
  }

  myOriginalHandler.execute(editor, dataContext);
}
 
Example 5
Source File: UsageViewUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static boolean reportNonRegularUsages(UsageInfo[] usages, final Project project) {
  boolean inGeneratedCode = hasUsagesInGeneratedCode(usages, project);
  if (hasNonCodeUsages(usages) || inGeneratedCode) {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
    if (statusBar != null) {
      statusBar.setInfo(inGeneratedCode ? RefactoringBundle.message("occurrences.found.in.comments.strings.non.java.files.and.generated.code")
                                        : RefactoringBundle.message("occurrences.found.in.comments.strings.and.non.java.files"));
    }
    return true;
  }
  return false;
}
 
Example 6
Source File: ReplaceInProjectManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void reportNumberReplacedOccurrences(Project project, int occurrences) {
  if (occurrences != 0) {
    final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
    if (statusBar != null) {
      statusBar.setInfo(FindBundle.message("0.occurrences.replaced", occurrences));
    }
  }
}
 
Example 7
Source File: StatusBarUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void setStatusBarInfo(@Nonnull Project project, @Nonnull @Nls String message) {
  final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
  if (statusBar != null) {
    statusBar.setInfo(message);
  }
}
 
Example 8
Source File: StatusBarProgress.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void setStatusBarText(StatusBar statusBar, String text) {
  updateRestoreText(statusBar);
  Pair<String, String> textsPair = myStatusBar2SavedText.get(statusBar);
  myStatusBar2SavedText.put(statusBar, pair(textsPair.first, text));
  statusBar.setInfo(text);
}