com.intellij.lang.annotation.Annotation.getMessage()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中com.intellij.lang.annotation.Annotation.getMessage()方法的一些代码示例,展示了Annotation.getMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.getMessage()方法的具体详情如下:
包路径:com.intellij.lang.annotation.Annotation
类名称:Annotation
方法名:getMessage

Annotation.getMessage介绍

暂无

代码示例

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

public void assertAnnotationNotContains(String filename, String content, String contains) {
  for (Annotation annotation : getAnnotationsAtCaret(filename, content)) {
    if(annotation.getMessage().contains(contains)) {
      fail(String.format("Fail not matching '%s' with '%s'", contains, annotation));
    }
  }
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

public void assertAnnotationContains(String filename, String content, String contains) {
  List<String> matches = new ArrayList<String>();
  for (Annotation annotation : getAnnotationsAtCaret(filename, content)) {
    matches.add(annotation.toString());
    if(annotation.getMessage().contains(contains)) {
      return;
    }
  }
  fail(String.format("Fail matches '%s' with one of %s", contains, matches));
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

/**
 * @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"))
  );
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

annotations.stream().findFirst().filter(annotation -> annotation.getMessage().contains("Create Template"))
);

代码示例来源:origin: SonarSource/sonarlint-intellij

@Test
public void testRangeIssues() {
 createStoredIssues(5);
 annotator.apply(psiFile, ctx, holder);
 for (int i = 0; i < 5; i++) {
  assertThat(holder.get(i).getStartOffset()).isEqualTo(i);
  assertThat(holder.get(i).getEndOffset()).isEqualTo(i + 10);
  assertThat(holder.get(i).getMessage()).contains("issue " + i);
  assertThat(holder.get(i).getSeverity()).isEqualTo(HighlightSeverity.WARNING);
  assertThat(holder.get(i).isFileLevelAnnotation()).isFalse();
 }
}

代码示例来源:origin: SonarSource/sonarlint-intellij

@Test
public void testFileLevelIssues() {
 createFileIssues(5);
 annotator.apply(psiFile, ctx, holder);
 assertThat(holder).hasSize(5);
 for (int i = 0; i < 5; i++) {
  assertThat(holder.get(i).getStartOffset()).isEqualTo(psiFileRange.getStartOffset());
  assertThat(holder.get(i).getEndOffset()).isEqualTo(psiFileRange.getEndOffset());
  assertThat(holder.get(i).isFileLevelAnnotation()).isTrue();
  assertThat(holder.get(i).getMessage()).contains("issue " + i);
  assertThat(holder.get(i).getSeverity()).isEqualTo(HighlightSeverity.WARNING);
 }
}

相关文章