예제 #1
0
    public void uninstall() {
      for (RangeHighlighter highlighter : myHighlighters) {
        highlighter.dispose();
      }

      Component internalComponent = myHighlighterView.getContentComponent();
      internalComponent.setCursor(myStoredCursor);
      internalComponent.removeKeyListener(myEditorKeyListener);
      myHighlighterView.getScrollingModel().removeVisibleAreaListener(myVisibleAreaListener);
      myFileEditorManager.removeFileEditorManagerListener(myFileEditorManagerListener);
    }
 @Override
 public boolean removeSegmentHighlighter(
     @NotNull Editor editor, @NotNull RangeHighlighter highlighter) {
   Map<RangeHighlighter, HighlightInfo> map = getHighlightInfoMap(editor, false);
   if (map == null) return false;
   HighlightInfo info = map.get(highlighter);
   if (info == null) return false;
   MarkupModel markupModel = info.editor.getMarkupModel();
   if (((MarkupModelEx) markupModel).containsHighlighter(highlighter)) {
     highlighter.dispose();
   }
   map.remove(highlighter);
   return true;
 }
  private static void clearLineMarkers(Editor editor) {
    final List<RangeHighlighter> oldHighlighters =
        editor.getUserData(TAG_TREE_HIGHLIGHTERS_IN_EDITOR_KEY);

    if (oldHighlighters != null) {
      final MarkupModelEx markupModel = (MarkupModelEx) editor.getMarkupModel();

      for (RangeHighlighter highlighter : oldHighlighters) {
        if (markupModel.containsHighlighter(highlighter)) {
          highlighter.dispose();
        }
      }
      editor.putUserData(TAG_TREE_HIGHLIGHTERS_IN_EDITOR_KEY, null);
    }
  }
  public static void clearHighlightingAndLineMarkers(
      final Editor editor, @NotNull Project project) {
    final MarkupModel markupModel =
        DocumentMarkupModel.forDocument(editor.getDocument(), project, true);

    for (RangeHighlighter highlighter : markupModel.getAllHighlighters()) {
      Object tooltip = highlighter.getErrorStripeTooltip();

      if (!(tooltip instanceof HighlightInfo)) {
        continue;
      }

      if (((HighlightInfo) tooltip).type == TYPE) {
        highlighter.dispose();
      }
    }

    clearLineMarkers(editor);
  }