Java Code Examples for com.intellij.openapi.editor.markup.RangeHighlighter#dispose()

The following examples show how to use com.intellij.openapi.editor.markup.RangeHighlighter#dispose() . 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: TextMergeChange.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
void setResolved(@Nonnull Side side, boolean value) {
  myResolved[side.getIndex()] = value;

  if (isResolved()) {
    destroyInnerHighlighters();
  }
  else {
    // Destroy only resolved side to reduce blinking
    Document document = myViewer.getEditor(side.select(ThreeSide.LEFT, ThreeSide.RIGHT)).getDocument();
    for (RangeHighlighter highlighter : myInnerHighlighters) {
      if (document.equals(highlighter.getDocument())) {
        highlighter.dispose(); // it's OK to call dispose() few times
      }
    }
  }
}
 
Example 2
Source File: TemplateState.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void focusCurrentHighlighter(boolean toSelect) {
  if (isFinished()) {
    return;
  }
  if (myCurrentVariableNumber >= myTabStopHighlighters.size()) {
    return;
  }
  RangeHighlighter segmentHighlighter = myTabStopHighlighters.get(myCurrentVariableNumber);
  if (segmentHighlighter != null) {
    final int segmentNumber = getCurrentSegmentNumber();
    RangeHighlighter newSegmentHighlighter = getSegmentHighlighter(segmentNumber, toSelect, false);
    if (newSegmentHighlighter != null) {
      segmentHighlighter.dispose();
      myTabStopHighlighters.set(myCurrentVariableNumber, newSegmentHighlighter);
    }
  }
}
 
Example 3
Source File: LineStatusTrackerBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@CalledInAwt
private void disposeHighlighter(@Nonnull Range range) {
  try {
    RangeHighlighter highlighter = range.getHighlighter();
    if (highlighter != null) {
      range.setHighlighter(null);
      highlighter.dispose();
    }
  }
  catch (Exception e) {
    LOG.error(e);
  }
}
 
Example 4
Source File: UnifiedDiffChange.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void destroyHighlighter() {
  for (RangeHighlighter highlighter : myHighlighters) {
    highlighter.dispose();
  }
  myHighlighters.clear();

  for (MyGutterOperation operation : myOperations) {
    operation.dispose();
  }
  myOperations.clear();
}
 
Example 5
Source File: SimpleDiffChange.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void destroyHighlighter() {
  for (RangeHighlighter highlighter : myHighlighters) {
    highlighter.dispose();
  }
  myHighlighters.clear();

  for (MyGutterOperation operation : myOperations) {
    operation.dispose();
  }
  myOperations.clear();
}
 
Example 6
Source File: ThreesideDiffChangeBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
protected void destroyHighlighters() {
  for (RangeHighlighter highlighter : myHighlighters) {
    highlighter.dispose();
  }
  myHighlighters.clear();
}
 
Example 7
Source File: ThreesideDiffChangeBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
protected void destroyInnerHighlighters() {
  for (RangeHighlighter highlighter : myInnerHighlighters) {
    highlighter.dispose();
  }
  myInnerHighlighters.clear();
}
 
Example 8
Source File: SimpleOnesideDiffViewer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@RequiredUIAccess
protected void onDispose() {
  for (RangeHighlighter highlighter : myHighlighters) {
    highlighter.dispose();
  }
  myHighlighters.clear();
  super.onDispose();
}
 
Example 9
Source File: SimpleOnesideDiffViewer.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void clearDiffPresentation() {
  myPanel.resetNotifications();

  for (RangeHighlighter highlighter : myHighlighters) {
    highlighter.dispose();
  }
  myHighlighters.clear();
}
 
Example 10
Source File: MarkupModelImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void removeAllHighlighters() {
  ApplicationManager.getApplication().assertIsDispatchThread();
  for (RangeHighlighter highlighter : getAllHighlighters()) {
    highlighter.dispose();
  }
  myCachedHighlighters = null;
  myHighlighterTree.clear();
  myHighlighterTreeForLines.clear();
}
 
Example 11
Source File: ApplyPatchChange.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void destroyHighlighters() {
  for (RangeHighlighter highlighter : myHighlighters) {
    highlighter.dispose();
  }
  myHighlighters.clear();

  for (MyGutterOperation operation : myOperations) {
    operation.dispose();
  }
  myOperations.clear();
}
 
Example 12
Source File: CtrlMouseHandler.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void uninstall() {
  for (RangeHighlighter highlighter : myHighlighters) {
    highlighter.dispose();
  }

  myHighlighterView.setCustomCursor(CtrlMouseHandler.class, null);
  myHighlighterView.getContentComponent().removeKeyListener(myEditorKeyListener);
  myHighlighterView.getScrollingModel().removeVisibleAreaListener(myVisibleAreaListener);
}
 
Example 13
Source File: IdentifierHighlighterPass.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void clearMyHighlights(Document document, Project project) {
  MarkupModel markupModel = DocumentMarkupModel.forDocument(document, project, true);
  for (RangeHighlighter highlighter : markupModel.getAllHighlighters()) {
    Object tooltip = highlighter.getErrorStripeTooltip();
    if (!(tooltip instanceof HighlightInfo)) {
      continue;
    }
    HighlightInfo info = (HighlightInfo)tooltip;
    if (info.type == HighlightInfoType.ELEMENT_UNDER_CARET_READ || info.type == HighlightInfoType.ELEMENT_UNDER_CARET_WRITE) {
      highlighter.dispose();
    }
  }
}
 
Example 14
Source File: TemplateState.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void releaseEditor() {
  if (myEditor != null) {
    for (RangeHighlighter segmentHighlighter : myTabStopHighlighters) {
      segmentHighlighter.dispose();
    }
    myTabStopHighlighters.clear();
    myEditor = null;
  }
}
 
Example 15
Source File: FoldingModelSupport.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void destroyHighlighter() {
  for (RangeHighlighter highlighter : myHighlighters) {
    highlighter.dispose();
  }
  myHighlighters.clear();
}
 
Example 16
Source File: ScopeHighlighter.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void dropHighlight() {
  for (RangeHighlighter h : myActiveHighliters) {
    h.dispose();
  }
  myActiveHighliters.clear();
}