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


Java RangeHighlighter.getEndOffset方法代码示例

本文整理汇总了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;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:11,代码来源:CCTestCase.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:IndentsPass.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:LivePreview.java


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