本文整理汇总了Java中com.intellij.openapi.editor.markup.RangeHighlighter.getEndOffset方法的典型用法代码示例。如果您正苦于以下问题:Java RangeHighlighter.getEndOffset方法的具体用法?Java RangeHighlighter.getEndOffset怎么用?Java RangeHighlighter.getEndOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.markup.RangeHighlighter
的用法示例。
在下文中一共展示了RangeHighlighter.getEndOffset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHighlighter
import com.intellij.openapi.editor.markup.RangeHighlighter; //导入方法依赖的package包/类
@Nullable
public static RangeHighlighter getHighlighter(MarkupModel model, AnswerPlaceholder placeholder) {
for (RangeHighlighter highlighter : model.getAllHighlighters()) {
int endOffset = placeholder.getOffset() + placeholder.getRealLength();
if (highlighter.getStartOffset() == placeholder.getOffset() && highlighter.getEndOffset() == endOffset) {
return highlighter;
}
}
return null;
}
示例2: compare
import com.intellij.openapi.editor.markup.RangeHighlighter; //导入方法依赖的package包/类
private static int compare(@NotNull TextRange r, @NotNull RangeHighlighter h) {
int answer = r.getStartOffset() - h.getStartOffset();
return answer != 0 ? answer : r.getEndOffset() - h.getEndOffset();
}
示例3: updateInSelectionHighlighters
import com.intellij.openapi.editor.markup.RangeHighlighter; //导入方法依赖的package包/类
private void updateInSelectionHighlighters() {
if (mySearchResults.getEditor() == null) return;
final SelectionModel selectionModel = mySearchResults.getEditor().getSelectionModel();
int[] starts = selectionModel.getBlockSelectionStarts();
int[] ends = selectionModel.getBlockSelectionEnds();
final HashSet<RangeHighlighter> toRemove = new HashSet<RangeHighlighter>();
Set<RangeHighlighter> toAdd = new HashSet<RangeHighlighter>();
for (RangeHighlighter highlighter : myHighlighters) {
if (!highlighter.isValid()) continue;
boolean intersectsWithSelection = false;
for (int i = 0; i < starts.length; ++i) {
TextRange selectionRange = new TextRange(starts[i], ends[i]);
intersectsWithSelection = selectionRange.intersects(highlighter.getStartOffset(), highlighter.getEndOffset()) &&
selectionRange.getEndOffset() != highlighter.getStartOffset() &&
highlighter.getEndOffset() != selectionRange.getStartOffset();
if (intersectsWithSelection) break;
}
final Object userData = highlighter.getUserData(IN_SELECTION_KEY);
if (userData != null) {
if (!intersectsWithSelection) {
if (userData == IN_SELECTION2) {
HighlightManager.getInstance(mySearchResults.getProject()).removeSegmentHighlighter(mySearchResults.getEditor(), highlighter);
toRemove.add(highlighter);
} else {
highlighter.putUserData(IN_SELECTION_KEY, null);
}
}
} else if (intersectsWithSelection) {
TextRange cursor = mySearchResults.getCursor();
if (cursor != null && highlighter.getStartOffset() == cursor.getStartOffset() &&
highlighter.getEndOffset() == cursor.getEndOffset()) continue;
final RangeHighlighter toAnnotate = highlightRange(new TextRange(highlighter.getStartOffset(), highlighter.getEndOffset()),
new TextAttributes(null, null, Color.WHITE, EffectType.ROUNDED_BOX, 0), toAdd);
highlighter.putUserData(IN_SELECTION_KEY, IN_SELECTION1);
toAnnotate.putUserData(IN_SELECTION_KEY, IN_SELECTION2);
}
}
myHighlighters.removeAll(toRemove);
myHighlighters.addAll(toAdd);
}