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


Java MarkupModel.getAllHighlighters方法代码示例

本文整理汇总了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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DocumentMarkupModelTest.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:22,代码来源:XmlTagTreeHighlightingPass.java

示例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;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:11,代码来源:CCTestCase.java

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

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

示例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);
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:BreakpointItem.java

示例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();
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:IdentifierHighlighterPass.java

示例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;
	}
 
开发者ID:antlr,项目名称:intellij-plugin-v4,代码行数:16,代码来源:MyActionUtils.java

示例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);
		}
	}
}
 
开发者ID:antlr,项目名称:intellij-plugin-v4,代码行数:13,代码来源:InputPanel.java

示例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);
		}
	}
}
 
开发者ID:antlr,项目名称:intellij-plugin-v4,代码行数:10,代码来源:InputPanel.java

示例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);
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:34,代码来源:BreakpointItem.java


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