本文整理匯總了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);
}