当前位置: 首页>>代码示例>>Java>>正文


Java HighlighterTargetArea.LINES_IN_RANGE属性代码示例

本文整理汇总了Java中com.intellij.openapi.editor.markup.HighlighterTargetArea.LINES_IN_RANGE属性的典型用法代码示例。如果您正苦于以下问题:Java HighlighterTargetArea.LINES_IN_RANGE属性的具体用法?Java HighlighterTargetArea.LINES_IN_RANGE怎么用?Java HighlighterTargetArea.LINES_IN_RANGE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.openapi.editor.markup.HighlighterTargetArea的用法示例。


在下文中一共展示了HighlighterTargetArea.LINES_IN_RANGE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: changedUpdateImpl

@Override
protected void changedUpdateImpl(@NotNull DocumentEvent e) {
  // todo Denis Zhdanov
  DocumentEventImpl event = (DocumentEventImpl)e;
  final boolean shouldTranslateViaDiff = isValid() && PersistentRangeMarkerUtil.shouldTranslateViaDiff(event, this);
  boolean wasTranslatedViaDiff = shouldTranslateViaDiff;
  if (shouldTranslateViaDiff) {
    wasTranslatedViaDiff = translatedViaDiff(e, event);
  }
  if (!wasTranslatedViaDiff) {
    super.changedUpdateImpl(e);
    if (isValid()) {
      myLine = getDocument().getLineNumber(getStartOffset());
      int endLine = getDocument().getLineNumber(getEndOffset());
      if (endLine != myLine) {
        setIntervalEnd(getDocument().getLineEndOffset(myLine));
      }
    }
  }
  if (isValid() && getTargetArea() == HighlighterTargetArea.LINES_IN_RANGE) {
    setIntervalStart(DocumentUtil.getFirstNonSpaceCharOffset(getDocument(), myLine));
    setIntervalEnd(getDocument().getLineEndOffset(myLine));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PersistentRangeHighlighterImpl.java

示例2: advanceSegmentHighlighters

private void advanceSegmentHighlighters() {
  myDoc.advance();
  myView.advance();

  boolean fileEnd = myStartOffset == myDocument.getTextLength();
  for (int i = myCurrentHighlighters.size() - 1; i >= 0; i--) {
    RangeHighlighterEx highlighter = myCurrentHighlighters.get(i);
    if (myReverseIteration ?
        highlighter.getAffectedAreaStartOffset() >= myStartOffset :
        fileEnd && highlighter.getTargetArea() == HighlighterTargetArea.LINES_IN_RANGE ? 
        highlighter.getAffectedAreaEndOffset() < myStartOffset : 
        highlighter.getAffectedAreaEndOffset() <= myStartOffset) {
      myCurrentHighlighters.remove(i);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:IterationState.java

示例3: changedUpdateImpl

@Override
protected void changedUpdateImpl(DocumentEvent e) {
  // todo Denis Zhdanov
  DocumentEventImpl event = (DocumentEventImpl)e;
  final boolean shouldTranslateViaDiff = PersistentRangeMarkerUtil.shouldTranslateViaDiff(event, this);
  boolean wasTranslatedViaDiff = shouldTranslateViaDiff;
  if (shouldTranslateViaDiff) {
    wasTranslatedViaDiff = translatedViaDiff(e, event);
  }
  if (!wasTranslatedViaDiff) {
    super.changedUpdateImpl(e);
    if (isValid()) {
      setLine(getDocument().getLineNumber(getStartOffset()));
      int endLine = getDocument().getLineNumber(getEndOffset());
      if (endLine != getLine()) {
        setIntervalEnd(getDocument().getLineEndOffset(getLine()));
      }
    }
  }
  if (isValid() && getTargetArea() == HighlighterTargetArea.LINES_IN_RANGE) {
    setIntervalStart(getDocument().getLineStartOffset(getLine()));
    setIntervalEnd(getDocument().getLineEndOffset(getLine()));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:PersistentRangeHighlighterImpl.java

示例4: changedUpdateImpl

@Override
protected void changedUpdateImpl(@Nonnull DocumentEvent e) {
  // todo Denis Zhdanov
  DocumentEventImpl event = (DocumentEventImpl)e;
  final boolean shouldTranslateViaDiff = isValid() && PersistentRangeMarkerUtil.shouldTranslateViaDiff(event, getStartOffset(), getEndOffset());
  boolean wasTranslatedViaDiff = shouldTranslateViaDiff;
  if (shouldTranslateViaDiff) {
    wasTranslatedViaDiff = translatedViaDiff(e, event);
  }
  if (!wasTranslatedViaDiff) {
    super.changedUpdateImpl(e);
    if (isValid()) {
      myLine = getDocument().getLineNumber(getStartOffset());
      int endLine = getDocument().getLineNumber(getEndOffset());
      if (endLine != myLine) {
        setIntervalEnd(getDocument().getLineEndOffset(myLine));
      }
    }
  }
  if (isValid() && getTargetArea() == HighlighterTargetArea.LINES_IN_RANGE) {
    setIntervalStart(DocumentUtil.getFirstNonSpaceCharOffset(getDocument(), myLine));
    setIntervalEnd(getDocument().getLineEndOffset(myLine));
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:PersistentRangeHighlighterImpl.java

示例5: advanceSegmentHighlighters

private void advanceSegmentHighlighters() {
  myDoc.advance();
  myView.advance();

  boolean fileEnd = myStartOffset == myDocument.getTextLength();
  for (int i = myCurrentHighlighters.size() - 1; i >= 0; i--) {
    RangeHighlighterEx highlighter = myCurrentHighlighters.get(i);
    if (myReverseIteration ?
        getAlignedStartOffset(highlighter) >= myStartOffset :
        fileEnd && highlighter.getTargetArea() == HighlighterTargetArea.LINES_IN_RANGE ?
        getAlignedEndOffset(highlighter) < myStartOffset :
        getAlignedEndOffset(highlighter) <= myStartOffset) {
      myCurrentHighlighters.remove(i);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:IterationState.java

示例6: getPastFileEndBackground

@Nullable
public Color getPastFileEndBackground() {
  boolean isInCaretRow = myEditor.getCaretModel().getLogicalPosition().line >= myDocument.getLineCount() - 1;

  Color caret = isInCaretRow && myCaretRowAttributes != null ? myCaretRowAttributes.getBackgroundColor() : null;

  ContainerUtil.quickSort(myCurrentHighlighters, LayerComparator.INSTANCE);

  //noinspection ForLoopReplaceableByForEach
  for (int i = 0; i < myCurrentHighlighters.size(); i++) {
    RangeHighlighterEx highlighter = myCurrentHighlighters.get(i);
    if (caret != null && highlighter.getLayer() < HighlighterLayer.CARET_ROW) {
      return caret;
    }

    if (highlighter.getTargetArea() != HighlighterTargetArea.LINES_IN_RANGE
        || myDocument.getLineNumber(highlighter.getEndOffset()) < myDocument.getLineCount() - 1) {
      continue;
    }

    TextAttributes textAttributes = highlighter.getTextAttributes();
    if (textAttributes != null) {
      Color backgroundColor = textAttributes.getBackgroundColor();
      if (backgroundColor != null) return backgroundColor;
    }
  }

  return caret;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:IterationState.java

示例7: updateAttributes

private static void updateAttributes(final EditorImpl editor, final int offset, final List<TextAttributes> attributes) {
  final List<RangeHighlighterEx> list1 = new ArrayList<>();
  final List<RangeHighlighterEx> list2 = new ArrayList<>();

  final Processor<RangeHighlighterEx> processor = highlighter -> {
    if (!highlighter.isValid()) return true;

    final boolean isLineHighlighter = highlighter.getTargetArea() == HighlighterTargetArea.LINES_IN_RANGE;

    if (isLineHighlighter || highlighter.getStartOffset() < offset) {
      list1.add(highlighter);
    }

    if (isLineHighlighter || highlighter.getEndOffset() > offset ||
        (highlighter.getEndOffset() == offset && (highlighter.isGreedyToRight()))) {
      list2.add(highlighter);
    }

    return true;
  };

  editor.getFilteredDocumentMarkupModel().processRangeHighlightersOverlappingWith(Math.max(0, offset - 1), offset, processor);
  editor.getMarkupModel().processRangeHighlightersOverlappingWith(Math.max(0, offset - 1), offset, processor);

  updateAttributes(editor, attributes.get(0), list1);
  updateAttributes(editor, attributes.get(1), list2);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:ImmediatePainter.java


注:本文中的com.intellij.openapi.editor.markup.HighlighterTargetArea.LINES_IN_RANGE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。