當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。