本文整理汇总了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);
}
}
示例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());
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例9: extensionAdded
import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
@Override
public void extensionAdded(@NotNull Annotator extension, @Nullable PluginDescriptor pluginDescriptor) {
cachedAnnotators.clear();
}
示例10: extensionRemoved
import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
@Override
public void extensionRemoved(@NotNull Annotator extension, @Nullable PluginDescriptor pluginDescriptor) {
cachedAnnotators.clear();
}
示例11: initialValue
import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
@NotNull
@Override
public Collection<Annotator> initialValue(@NotNull Language key) {
return LanguageAnnotators.INSTANCE.allForLanguage(key);
}
示例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);
}
示例13: get
import com.intellij.lang.annotation.Annotator; //导入依赖的package包/类
@Nonnull
List<Annotator> get(@Nonnull String languageId) {
return cachedAnnotators.get(languageId);
}