Java Code Examples for com.intellij.openapi.editor.ex.EditorEx#repaint()

The following examples show how to use com.intellij.openapi.editor.ex.EditorEx#repaint() . 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: WidgetIndentsHighlightingPassFactory.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void settingsChanged() {
  if (project.isDisposed()) {
    return;
  }
  final FlutterSettings settings = FlutterSettings.getInstance();
  // Skip if none of the settings that impact Widget Idents were changed.
  if (isShowBuildMethodGuides == settings.isShowBuildMethodGuides()) {
    // Change doesn't matter for us.
    return;
  }
  syncSettings(settings);

  for (EditorEx editor : editorOutlineService.getActiveDartEditors()) {
    updateEditorSettings(editor);
    // To be safe, avoid rendering artfacts when settings were changed
    // that only impacted rendering.
    editor.repaint(0, editor.getDocument().getTextLength());
  }
}
 
Example 2
Source File: FilteredIndentsHighlightingPass.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static void onWidgetIndentsChanged(EditorEx editor, WidgetIndentHitTester oldHitTester, WidgetIndentHitTester newHitTester) {
  final List<RangeHighlighter> highlighters = editor.getUserData(INDENT_HIGHLIGHTERS_IN_EDITOR_KEY);
  if (highlighters != null) {
    final Document doc = editor.getDocument();
    final int textLength = doc.getTextLength();
    for (RangeHighlighter highlighter : highlighters) {
      if (!highlighter.isValid()) {
        continue;
      }
      final LineRange range = getGuideLineRange(editor, highlighter);
      if (range != null) {
        final boolean before = WidgetIndentsHighlightingPass.isIndentGuideHidden(oldHitTester, range);
        final boolean after = WidgetIndentsHighlightingPass.isIndentGuideHidden(newHitTester, range);
        if (before != after) {
          int safeStart = min(highlighter.getStartOffset(), textLength);
          int safeEnd = min(highlighter.getEndOffset(), textLength);
          if (safeEnd > safeStart) {
            editor.repaint(safeStart, safeEnd);
          }
        }
      }
    }
  }
}
 
Example 3
Source File: WidgetIndentsHighlightingPassFactory.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void settingsChanged() {
  if (project.isDisposed()) {
    return;
  }
  final FlutterSettings settings = FlutterSettings.getInstance();
  // Skip if none of the settings that impact Widget Idents were changed.
  if (isShowBuildMethodGuides == settings.isShowBuildMethodGuides()) {
    // Change doesn't matter for us.
    return;
  }
  syncSettings(settings);

  for (EditorEx editor : editorOutlineService.getActiveDartEditors()) {
    updateEditorSettings(editor);
    // To be safe, avoid rendering artfacts when settings were changed
    // that only impacted rendering.
    editor.repaint(0, editor.getDocument().getTextLength());
  }
}
 
Example 4
Source File: FilteredIndentsHighlightingPass.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static void onWidgetIndentsChanged(EditorEx editor, WidgetIndentHitTester oldHitTester, WidgetIndentHitTester newHitTester) {
  final List<RangeHighlighter> highlighters = editor.getUserData(INDENT_HIGHLIGHTERS_IN_EDITOR_KEY);
  if (highlighters != null) {
    final Document doc = editor.getDocument();
    final int textLength = doc.getTextLength();
    for (RangeHighlighter highlighter : highlighters) {
      if (!highlighter.isValid()) {
        continue;
      }
      final LineRange range = getGuideLineRange(editor, highlighter);
      if (range != null) {
        final boolean before = WidgetIndentsHighlightingPass.isIndentGuideHidden(oldHitTester, range);
        final boolean after = WidgetIndentsHighlightingPass.isIndentGuideHidden(newHitTester, range);
        if (before != after) {
          int safeStart = min(highlighter.getStartOffset(), textLength);
          int safeEnd = min(highlighter.getEndOffset(), textLength);
          if (safeEnd > safeStart) {
            editor.repaint(safeStart, safeEnd);
          }
        }
      }
    }
  }
}
 
Example 5
Source File: WidgetIndentsHighlightingPass.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void onCaretPositionChanged(EditorEx editor, Caret caret) {
  final WidgetIndentsPassData data = getIndentsPassData(editor);
  if (data == null || data.highlighters == null) return;
  for (RangeHighlighter h : data.highlighters) {
    if (h.getCustomRenderer() instanceof WidgetIndentsHighlightingPass.WidgetCustomHighlighterRenderer) {
      final WidgetIndentsHighlightingPass.WidgetCustomHighlighterRenderer renderer =
        (WidgetIndentsHighlightingPass.WidgetCustomHighlighterRenderer)h.getCustomRenderer();
      final boolean changed = renderer.updateSelected(editor, h, caret);
      if (changed) {
        editor.repaint(h.getStartOffset(), h.getEndOffset());
      }
    }
  }
}
 
Example 6
Source File: WidgetIndentsHighlightingPass.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void onCaretPositionChanged(EditorEx editor, Caret caret) {
  final WidgetIndentsPassData data = getIndentsPassData(editor);
  if (data == null || data.highlighters == null) return;
  for (RangeHighlighter h : data.highlighters) {
    if (h.getCustomRenderer() instanceof WidgetIndentsHighlightingPass.WidgetCustomHighlighterRenderer) {
      final WidgetIndentsHighlightingPass.WidgetCustomHighlighterRenderer renderer =
        (WidgetIndentsHighlightingPass.WidgetCustomHighlighterRenderer)h.getCustomRenderer();
      final boolean changed = renderer.updateSelected(editor, h, caret);
      if (changed) {
        editor.repaint(h.getStartOffset(), h.getEndOffset());
      }
    }
  }
}