本文整理汇总了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));
}
}
示例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);
}
}
}
示例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()));
}
}
示例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));
}
}
示例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);
}
}
}
示例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;
}
示例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);
}