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


Java Annotator类代码示例

本文整理汇总了Java中com.intellij.lang.annotation.Annotator的典型用法代码示例。如果您正苦于以下问题:Java Annotator类的具体用法?Java Annotator怎么用?Java Annotator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Annotator类属于com.intellij.lang.annotation包,在下文中一共展示了Annotator类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runAnnotators

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
private void runAnnotators(PsiElement element) {
  List<Annotator> annotators = cachedAnnotators.get(element.getLanguage().getID());
  if (annotators.isEmpty()) return;
  final boolean dumb = myDumbService.isDumb();

  //noinspection ForLoopReplaceableByForEach
  for (int i = 0; i < annotators.size(); i++) {
    Annotator annotator = annotators.get(i);
    if (dumb && !DumbService.isDumbAware(annotator)) {
      continue;
    }

    ProgressManager.checkCanceled();

    annotator.annotate(element, myAnnotationHolder);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DefaultHighlightVisitor.java

示例2: testInfoTestAttributes

import com.intellij.lang.annotation.Annotator; //导入依赖的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

示例3: runAnnotators

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
private void runAnnotators(PsiElement element) {
  List<Annotator> annotators = cachedAnnotators.get(element.getLanguage());
  if (annotators.isEmpty()) return;
  final boolean dumb = myDumbService.isDumb();

  //noinspection ForLoopReplaceableByForEach
  for (int i = 0; i < annotators.size(); i++) {
    Annotator annotator = annotators.get(i);
    if (dumb && !DumbService.isDumbAware(annotator)) {
      continue;
    }

    ProgressManager.checkCanceled();

    annotator.annotate(element, myAnnotationHolder);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:DefaultHighlightVisitor.java

示例4: runAnnotators

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
private void runAnnotators(PsiElement element) {
  List<Annotator> annotators = myCachedAnnotators.get(element.getLanguage().getID());
  if (annotators.isEmpty()) return;
  final boolean dumb = myDumbService.isDumb();

  //noinspection ForLoopReplaceableByForEach
  for (int i = 0; i < annotators.size(); i++) {
    Annotator annotator = annotators.get(i);
    if (dumb && !DumbService.isDumbAware(annotator)) {
      continue;
    }

    ProgressManager.checkCanceled();

    annotator.annotate(element, myAnnotationHolder);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:DefaultHighlightVisitor.java

示例5: testAnnotator

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
public void testAnnotator() throws Exception {
  Annotator annotator = new MyAnnotator();
  Language javaLanguage = StdFileTypes.JAVA.getLanguage();
  LanguageAnnotators.INSTANCE.addExplicitExtension(javaLanguage, annotator);
  enableInspectionTool(new DefaultHighlightVisitorBasedInspection.AnnotatorBasedInspection());
  try {
    doAllTests();
  }
  finally {
    LanguageAnnotators.INSTANCE.removeExplicitExtension(javaLanguage, annotator);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:FixAllAnnotatorQuickfixTest.java

示例6: getAnnotationsAtCaret

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
@NotNull
private AnnotationHolderImpl getAnnotationsAtCaret(String filename, String content) {
    PsiFile psiFile = myFixture.configureByText(filename, content);
    PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());

    AnnotationHolderImpl annotations = new AnnotationHolderImpl(new AnnotationSession(psiFile));

    for (Annotator annotator : LanguageAnnotators.INSTANCE.allForLanguage(psiFile.getLanguage())) {
        annotator.annotate(psiElement, annotations);
    }

    return annotations;
}
 
开发者ID:Haehnchen,项目名称:idea-php-shopware-plugin,代码行数:14,代码来源:ShopwareLightCodeInsightFixtureTestCase.java

示例7: testAnnotator

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
public void testAnnotator() throws Exception {
  Annotator annotator = new MyAnnotator();
  Language javaLanguage = JavaFileType.INSTANCE.getLanguage();
  LanguageAnnotators.INSTANCE.addExplicitExtension(javaLanguage, annotator);
  enableInspectionTool(new DefaultHighlightVisitorBasedInspection.AnnotatorBasedInspection());
  try {
    doAllTests();
  }
  finally {
    LanguageAnnotators.INSTANCE.removeExplicitExtension(javaLanguage, annotator);
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:13,代码来源:FixAllAnnotatorQuickfixTest.java

示例8: initialValue

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
@NotNull
@Override
public Collection<Annotator> initialValue(@NotNull String languageId) {
  Language language = Language.findLanguageByID(languageId);
  return language == null ? ContainerUtil.<Annotator>emptyList() : LanguageAnnotators.INSTANCE.allForLanguage(language);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DefaultHighlightVisitor.java

示例9: extensionAdded

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
@Override
public void extensionAdded(@NotNull Annotator extension, @Nullable PluginDescriptor pluginDescriptor) {
  cachedAnnotators.clear();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DefaultHighlightVisitor.java

示例10: extensionRemoved

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
@Override
public void extensionRemoved(@NotNull Annotator extension, @Nullable PluginDescriptor pluginDescriptor) {
  cachedAnnotators.clear();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DefaultHighlightVisitor.java

示例11: initialValue

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
@NotNull
@Override
public Collection<Annotator> initialValue(@NotNull Language key) {
  return LanguageAnnotators.INSTANCE.allForLanguage(key);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:DefaultHighlightVisitor.java

示例12: initialValue

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
@Nonnull
@Override
public Collection<Annotator> initialValue(@Nonnull String languageId) {
  Language language = Language.findLanguageByID(languageId);
  return language == null ? ContainerUtil.<Annotator>emptyList() : LanguageAnnotators.INSTANCE.allForLanguage(language);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:CachedAnnotators.java

示例13: get

import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
@Nonnull
List<Annotator> get(@Nonnull String languageId) {
  return cachedAnnotators.get(languageId);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:CachedAnnotators.java


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