本文整理汇总了Java中com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl类的典型用法代码示例。如果您正苦于以下问题:Java AnnotationHolderImpl类的具体用法?Java AnnotationHolderImpl怎么用?Java AnnotationHolderImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnnotationHolderImpl类属于com.intellij.codeInsight.daemon.impl包,在下文中一共展示了AnnotationHolderImpl类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkFileWithExternalAnnotator
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl; //导入依赖的package包/类
@NotNull
public static <Init,Result> ProblemDescriptor[] checkFileWithExternalAnnotator(@NotNull PsiFile file,
@NotNull InspectionManager manager,
boolean isOnTheFly,
@NotNull ExternalAnnotator<Init,Result> annotator) {
if (isOnTheFly) {
// ExternalAnnotator does this work
return ProblemDescriptor.EMPTY_ARRAY;
}
Init info = annotator.collectInformation(file);
if (info != null) {
Result annotationResult = annotator.doAnnotate(info);
if (annotationResult == null) {
return ProblemDescriptor.EMPTY_ARRAY;
}
AnnotationHolderImpl annotationHolder = new AnnotationHolderImpl(new AnnotationSession(file));
annotator.apply(file, annotationResult, annotationHolder);
return convertToProblemDescriptors(annotationHolder, manager, file);
}
return ProblemDescriptor.EMPTY_ARRAY;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ExternalAnnotatorInspectionVisitor.java
示例2: runXmlFileSchemaValidation
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl; //导入依赖的package包/类
private Map<ProblemDescriptor, HighlightDisplayLevel> runXmlFileSchemaValidation(@NotNull XmlFile xmlFile) {
final AnnotationHolderImpl holder = new AnnotationHolderImpl(new AnnotationSession(xmlFile));
final List<ExternalAnnotator> annotators = ExternalLanguageAnnotators.allForFile(StdLanguages.XML, xmlFile);
for (ExternalAnnotator<?, ?> annotator : annotators) {
processAnnotator(xmlFile, holder, annotator);
}
if (!holder.hasAnnotations()) return Collections.emptyMap();
Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
for (final Annotation annotation : holder) {
final HighlightInfo info = HighlightInfo.fromAnnotation(annotation);
if (info.getSeverity() == HighlightSeverity.INFORMATION) continue;
final PsiElement startElement = xmlFile.findElementAt(info.startOffset);
final PsiElement endElement = info.startOffset == info.endOffset ? startElement : xmlFile.findElementAt(info.endOffset - 1);
if (startElement == null || endElement == null) continue;
final ProblemDescriptor descriptor =
myInspectionManager.createProblemDescriptor(startElement, endElement, info.getDescription(), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
false);
final HighlightDisplayLevel level = info.getSeverity() == HighlightSeverity.ERROR? HighlightDisplayLevel.ERROR: HighlightDisplayLevel.WARNING;
problemsMap.put(descriptor, level);
}
return problemsMap;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:InspectionValidatorWrapper.java
示例3: processAnnotator
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl; //导入依赖的package包/类
private static <X, Y> void processAnnotator(@NotNull XmlFile xmlFile, AnnotationHolderImpl holder, ExternalAnnotator<X, Y> annotator) {
X initial = annotator.collectInformation(xmlFile);
if (initial != null) {
Y result = annotator.doAnnotate(initial);
if (result != null) {
annotator.apply(xmlFile, result, holder);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:InspectionValidatorWrapper.java
示例4: createAnnotator
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl; //导入依赖的package包/类
private GlobErrorAnnotator createAnnotator(PsiFile file) {
annotationHolder = new AnnotationHolderImpl(new AnnotationSession(file));
return new GlobErrorAnnotator() {
@Override
protected AnnotationHolder getHolder() {
return annotationHolder;
}
};
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:10,代码来源:GlobValidationTest.java
示例5: createAnnotator
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl; //导入依赖的package包/类
private LoadStatementAnnotator createAnnotator(PsiFile file) {
annotationHolder = new AnnotationHolderImpl(new AnnotationSession(file));
return new LoadStatementAnnotator() {
@Override
protected AnnotationHolder getHolder() {
return annotationHolder;
}
};
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:10,代码来源:LoadStatementAnnotatorTest.java
示例6: createAnnotator
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl; //导入依赖的package包/类
private BuiltInRuleAnnotator createAnnotator(PsiFile file) {
annotationHolder = new AnnotationHolderImpl(new AnnotationSession(file));
return new BuiltInRuleAnnotator() {
@Override
protected AnnotationHolder getHolder() {
return annotationHolder;
}
};
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:10,代码来源:BuiltInRuleAnnotatorTest.java
示例7: getAnnotationsAtCaret
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl; //导入依赖的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
示例8: runXmlFileSchemaValidation
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl; //导入依赖的package包/类
private Map<ProblemDescriptor, HighlightDisplayLevel> runXmlFileSchemaValidation(@NotNull XmlFile xmlFile) {
final AnnotationHolderImpl holder = new AnnotationHolderImpl(new AnnotationSession(xmlFile));
final List<ExternalAnnotator> annotators = ExternalLanguageAnnotators.allForFile(StdLanguages.XML, xmlFile);
for (ExternalAnnotator annotator : annotators) {
annotator.annotate(xmlFile, holder);
}
if (!holder.hasAnnotations()) return Collections.emptyMap();
Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
for (final Annotation annotation : holder) {
final HighlightInfo info = HighlightInfo.fromAnnotation(annotation);
if (info.getSeverity() == HighlightSeverity.INFORMATION) continue;
final PsiElement startElement = xmlFile.findElementAt(info.startOffset);
final PsiElement endElement = info.startOffset == info.endOffset ? startElement : xmlFile.findElementAt(info.endOffset - 1);
if (startElement == null || endElement == null) continue;
final ProblemDescriptor descriptor =
myInspectionManager.createProblemDescriptor(startElement, endElement, info.getDescription(), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
false);
final HighlightDisplayLevel level = info.getSeverity() == HighlightSeverity.ERROR? HighlightDisplayLevel.ERROR: HighlightDisplayLevel.WARNING;
problemsMap.put(descriptor, level);
}
return problemsMap;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:InspectionValidatorWrapper.java
示例9: testThatTemplateCreationAnnotationProvidesQuickfix
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl; //导入依赖的package包/类
/**
* @see TemplateAnnotationAnnotator#annotate
*/
public void testThatTemplateCreationAnnotationProvidesQuickfix() {
PsiFile psiFile = myFixture.configureByText("foobar.php", "<?php\n" +
"use Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Template;\n" +
"\n" +
"class Foobar\n" +
"{\n" +
" /**\n" +
" * @Temp<caret>late(\"foobar.html.twig\")\n" +
" */\n" +
" public function fooAction()\n" +
" {\n" +
" }\n" +
"}\n" +
""
);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
PsiElement phpDocTag = psiElement.getParent();
AnnotationHolderImpl annotations = new AnnotationHolderImpl(new AnnotationSession(psiFile));
new TemplateAnnotationAnnotator().annotate(new PhpAnnotationDocTagAnnotatorParameter(
PhpIndex.getInstance(getProject()).getAnyByFQN(TwigUtil.TEMPLATE_ANNOTATION_CLASS).iterator().next(),
(PhpDocTag) phpDocTag,
annotations
));
assertNotNull(
annotations.stream().findFirst().filter(annotation -> annotation.getMessage().contains("Create Template"))
);
}
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:35,代码来源:TemplateAnnotationAnnotatorTest.java
示例10: testThatTemplateCreationForInvokeMethodProvidesQuickfix
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl; //导入依赖的package包/类
/**
* @see TemplateAnnotationAnnotator#annotate
*/
public void testThatTemplateCreationForInvokeMethodProvidesQuickfix() {
myFixture.copyFileToProject("controller_method.php");
myFixture.configureByText(PhpFileType.INSTANCE, "<?php\n" +
"namespace FooBundle\\Controller;\n" +
"class FoobarController\n" +
"{\n" +
" public function __in<caret>voke() {}\n" +
"" +
"}\n"
);
PsiFile psiFile = myFixture.configureByText("foobar.php", "<?php\n" +
"use Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Template;\n" +
"\n" +
"class Foobar\n" +
"{\n" +
" /**\n" +
" * @Temp<caret>late()\n" +
" */\n" +
" public function __invoke()\n" +
" {\n" +
" }\n" +
"}\n" +
""
);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
PsiElement phpDocTag = psiElement.getParent();
AnnotationHolderImpl annotations = new AnnotationHolderImpl(new AnnotationSession(psiFile));
new TemplateAnnotationAnnotator().annotate(new PhpAnnotationDocTagAnnotatorParameter(
PhpIndex.getInstance(getProject()).getAnyByFQN(TwigUtil.TEMPLATE_ANNOTATION_CLASS).iterator().next(),
(PhpDocTag) phpDocTag,
annotations
));
assertNotNull(
annotations.stream().findFirst().filter(annotation -> annotation.getMessage().contains("Create Template"))
);
}
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:46,代码来源:TemplateAnnotationAnnotatorTest.java
注:本文中的com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论