本文整理汇总了Java中com.intellij.openapi.editor.markup.MarkupModel.removeHighlighter方法的典型用法代码示例。如果您正苦于以下问题:Java MarkupModel.removeHighlighter方法的具体用法?Java MarkupModel.removeHighlighter怎么用?Java MarkupModel.removeHighlighter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.markup.MarkupModel
的用法示例。
在下文中一共展示了MarkupModel.removeHighlighter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateHighLights
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的package包/类
private void updateHighLights(Editor editor) {
MarkupModel markup = editor.getMarkupModel();
for (RangeHighlighter customRangeHighlighter : newCommentHighlighters) {
markup.removeHighlighter(customRangeHighlighter);
}
newCommentHighlighters.clear();
int lineCount = markup.getDocument().getLineCount();
Map<Integer, List<Comment>> lineComments = lineComments(comments);
for (Map.Entry<Integer, List<Comment>> entry : lineComments.entrySet()) {
if (entry.getKey() > lineCount) continue;
boolean hasNewComments = false;
for (Comment comment : entry.getValue()) {
if (comment.id == null) {
hasNewComments = true;
break;
}
}
TextAttributes attributes = new TextAttributes();
if (hasNewComments) attributes.setBackgroundColor(JBColor.PINK);
else attributes.setBackgroundColor(JBColor.YELLOW);
RangeHighlighter rangeHighlighter = markup
.addLineHighlighter(entry.getKey() - 1, HighlighterLayer.SELECTION + (hasNewComments ? 2 : 1), attributes);
rangeHighlighter.setGutterIconRenderer(new CommentGutterIconRenderer());
newCommentHighlighters.add(rangeHighlighter);
}
}
示例2: clearTokenInfoHighlighters
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的package包/类
/**
* Remove any previous underlining or boxing, but not errors or decision event info
*/
public static void clearTokenInfoHighlighters(Editor editor) {
MarkupModel markupModel = editor.getMarkupModel();
for (RangeHighlighter r : markupModel.getAllHighlighters()) {
if ( r.getUserData(ProfilerPanel.DECISION_EVENT_INFO_KEY)==null &&
r.getUserData(SYNTAX_ERROR)==null ) {
markupModel.removeHighlighter(r);
}
}
}
示例3: removeHighlighters
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的package包/类
public static void removeHighlighters(Editor editor, Key<?> key) {
// Remove anything with user data accessible via key
MarkupModel markupModel = editor.getMarkupModel();
for (RangeHighlighter r : markupModel.getAllHighlighters()) {
if ( r.getUserData(key)!=null ) {
markupModel.removeHighlighter(r);
}
}
}