本文整理汇总了Java中com.intellij.openapi.editor.markup.MarkupModel.getAllHighlighters方法的典型用法代码示例。如果您正苦于以下问题:Java MarkupModel.getAllHighlighters方法的具体用法?Java MarkupModel.getAllHighlighters怎么用?Java MarkupModel.getAllHighlighters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.markup.MarkupModel
的用法示例。
在下文中一共展示了MarkupModel.getAllHighlighters方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInfoTestAttributes
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的package包/类
public void testInfoTestAttributes() throws Exception {
LanguageExtensionPoint<Annotator> extension = new LanguageExtensionPoint<Annotator>();
extension.language="TEXT";
extension.implementationClass = TestAnnotator.class.getName();
PlatformTestUtil.registerExtension(ExtensionPointName.create(LanguageAnnotators.EP_NAME), extension, getTestRootDisposable());
myFixture.configureByText(PlainTextFileType.INSTANCE, "foo");
EditorColorsScheme scheme = new EditorColorsSchemeImpl(new DefaultColorsScheme()){{initFonts();}};
scheme.setAttributes(HighlighterColors.TEXT, new TextAttributes(Color.black, Color.white, null, null, Font.PLAIN));
((EditorEx)myFixture.getEditor()).setColorsScheme(scheme);
myFixture.doHighlighting();
MarkupModel model = DocumentMarkupModel.forDocument(myFixture.getEditor().getDocument(), getProject(), false);
RangeHighlighter[] highlighters = model.getAllHighlighters();
assertEquals(1, highlighters.length);
TextAttributes attributes = highlighters[0].getTextAttributes();
assertNotNull(attributes);
assertNull(attributes.getBackgroundColor());
assertNull(attributes.getForegroundColor());
}
示例2: clearHighlightingAndLineMarkers
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的package包/类
public static void clearHighlightingAndLineMarkers(final Editor editor, @NotNull Project project)
{
final MarkupModel markupModel = DocumentMarkupModel.forDocument(editor.getDocument(), project, true);
for(RangeHighlighter highlighter : markupModel.getAllHighlighters())
{
Object tooltip = highlighter.getErrorStripeTooltip();
if(!(tooltip instanceof HighlightInfo))
{
continue;
}
if(((HighlightInfo) tooltip).type == TYPE)
{
highlighter.dispose();
}
}
clearLineMarkers(editor);
}
示例3: getHighlighter
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的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;
}
示例4: showInEditor
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的package包/类
protected static void showInEditor(DetailView panel, VirtualFile virtualFile, int line) {
TextAttributes attributes =
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.BREAKPOINT_ATTRIBUTES);
DetailView.PreviewEditorState state = DetailView.PreviewEditorState.create(virtualFile, line, attributes);
if (state.equals(panel.getEditorState())) {
return;
}
panel.navigateInPreviewEditor(state);
TextAttributes softerAttributes = attributes.clone();
Color backgroundColor = softerAttributes.getBackgroundColor();
if (backgroundColor != null) {
softerAttributes.setBackgroundColor(ColorUtil.softer(backgroundColor));
}
final Editor editor = panel.getEditor();
if (editor != null) {
final MarkupModel editorModel = editor.getMarkupModel();
final MarkupModel documentModel =
DocumentMarkupModel.forDocument(editor.getDocument(), editor.getProject(), false);
for (RangeHighlighter highlighter : documentModel.getAllHighlighters()) {
if (highlighter.getUserData(DebuggerColors.BREAKPOINT_HIGHLIGHTER_KEY) == Boolean.TRUE) {
final int line1 = editor.offsetToLogicalPosition(highlighter.getStartOffset()).line;
if (line1 != line) {
editorModel.addLineHighlighter(line1,
DebuggerColors.BREAKPOINT_HIGHLIGHTER_LAYER + 1, softerAttributes);
}
}
}
}
}
示例5: clearMyHighlights
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的package包/类
public static void clearMyHighlights(Document document, Project project) {
MarkupModel markupModel = DocumentMarkupModel.forDocument(document, project, true);
for (RangeHighlighter highlighter : markupModel.getAllHighlighters()) {
Object tooltip = highlighter.getErrorStripeTooltip();
if (!(tooltip instanceof HighlightInfo)) {
continue;
}
HighlightInfo info = (HighlightInfo)tooltip;
if (info.type == HighlightInfoType.ELEMENT_UNDER_CARET_READ || info.type == HighlightInfoType.ELEMENT_UNDER_CARET_WRITE) {
highlighter.dispose();
}
}
}
示例6: showInEditor
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的package包/类
protected static void showInEditor(DetailView panel, VirtualFile virtualFile, int line) {
TextAttributes attributes =
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.BREAKPOINT_ATTRIBUTES);
DetailView.PreviewEditorState state = DetailView.PreviewEditorState.create(virtualFile, line, attributes);
if (state.equals(panel.getEditorState())) {
return;
}
panel.navigateInPreviewEditor(state);
TextAttributes softerAttributes = attributes.clone();
Color backgroundColor = softerAttributes.getBackgroundColor();
if (backgroundColor != null) {
softerAttributes.setBackgroundColor(ColorUtil.softer(backgroundColor));
}
final Editor editor = panel.getEditor();
final MarkupModel editorModel = editor.getMarkupModel();
final MarkupModel documentModel =
DocumentMarkupModel.forDocument(editor.getDocument(), editor.getProject(), false);
for (RangeHighlighter highlighter : documentModel.getAllHighlighters()) {
if (highlighter.getUserData(DebuggerColors.BREAKPOINT_HIGHLIGHTER_KEY) == Boolean.TRUE) {
final int line1 = editor.offsetToLogicalPosition(highlighter.getStartOffset()).line;
if (line1 != line) {
editorModel.addLineHighlighter(line1,
DebuggerColors.BREAKPOINT_HIGHLIGHTER_LAYER + 1, softerAttributes);
}
}
}
}
示例7: clearMyHighlights
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的package包/类
public static void clearMyHighlights(Document document, Project project) {
MarkupModel markupModel = DocumentMarkupModel.forDocument(document, project, true);
for (RangeHighlighter highlighter : markupModel.getAllHighlighters()) {
Object tooltip = highlighter.getErrorStripeTooltip();
if (!(tooltip instanceof HighlightInfo)) {
continue;
}
HighlightInfo info = (HighlightInfo)tooltip;
if (info.type == ourReadHighlightInfoType || info.type == ourWriteHighlightInfoType) {
highlighter.dispose();
}
}
}
示例8: getRangeHighlightersAtOffset
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的package包/类
@NotNull
public static List<RangeHighlighter> getRangeHighlightersAtOffset(Editor editor, int offset) {
MarkupModel markupModel = editor.getMarkupModel();
// collect all highlighters and combine to make a single tool tip
List<RangeHighlighter> highlightersAtOffset = new ArrayList<RangeHighlighter>();
for (RangeHighlighter r : markupModel.getAllHighlighters()) {
int a = r.getStartOffset();
int b = r.getEndOffset();
// System.out.printf("#%d: %d..%d %s\n", i, a, b, r.toString());
if (offset >= a && offset < b) { // cursor is over some kind of highlighting
highlightersAtOffset.add(r);
}
}
return highlightersAtOffset;
}
示例9: 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);
}
}
}
示例10: 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);
}
}
}
示例11: showInEditor
import com.intellij.openapi.editor.markup.MarkupModel; //导入方法依赖的package包/类
protected static void showInEditor(DetailView panel, VirtualFile virtualFile, int line) {
TextAttributes attributes =
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.BREAKPOINT_ATTRIBUTES);
DetailView.PreviewEditorState state = DetailView.PreviewEditorState.create(virtualFile, line, attributes);
if (state.equals(panel.getEditorState())) {
return;
}
panel.navigateInPreviewEditor(state);
TextAttributes softerAttributes = attributes.clone();
Color backgroundColor = softerAttributes.getBackgroundColor();
if (backgroundColor != null) {
softerAttributes.setBackgroundColor(ColorUtil.softer(backgroundColor));
}
final Editor editor = panel.getEditor();
final MarkupModel editorModel = editor.getMarkupModel();
final MarkupModel documentModel =
DocumentMarkupModel.forDocument(editor.getDocument(), editor.getProject(), false);
for (RangeHighlighter highlighter : documentModel.getAllHighlighters()) {
if (highlighter.getUserData(DebuggerColors.BREAKPOINT_HIGHLIGHTER_KEY) == Boolean.TRUE) {
final int line1 = editor.offsetToLogicalPosition(highlighter.getStartOffset()).line;
if (line1 != line) {
editorModel.addLineHighlighter(line1,
DebuggerColors.BREAKPOINT_HIGHLIGHTER_LAYER + 1, softerAttributes);
}
}
}
}