当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationHolder.createInfoAnnotation方法代码示例

本文整理汇总了Java中com.intellij.lang.annotation.AnnotationHolder.createInfoAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationHolder.createInfoAnnotation方法的具体用法?Java AnnotationHolder.createInfoAnnotation怎么用?Java AnnotationHolder.createInfoAnnotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.lang.annotation.AnnotationHolder的用法示例。


在下文中一共展示了AnnotationHolder.createInfoAnnotation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: annotate

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
	if (!(element instanceof SQFCommand)) {
		return;
	}
	SQFCommand command = (SQFCommand) element;
	switch (command.getCommandName().toLowerCase()) {
		case "if": //fall
		case "then": //fall
		case "else": //fall
		case "for": //fall
		case "foreach": //fall
		case "switch": //fall
		case "case": //fall
		case "default": //fall
		case "while"://fall
		case "do": {
			Annotation annotation = holder.createInfoAnnotation(command, "");
			annotation.setTextAttributes(SQFSyntaxHighlighter.CONTROL_STRUCTURE_COMMAND);
			break;
		}
	}
}
 
开发者ID:kayler-renslow,项目名称:arma-intellij-plugin,代码行数:24,代码来源:SQFControlStructureCommandAnnotator.java

示例2: annotate

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
@Override
public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) {
  if (psiElement instanceof PsiField) {
    PsiField field = (PsiField) psiElement;
    final PsiFile boundForm = FormReferenceProvider.getFormFile(field);
    if (boundForm != null) {
      annotateFormField(field, boundForm, holder);
    }
  }
  else if (psiElement instanceof PsiClass) {
    PsiClass aClass = (PsiClass) psiElement;
    final List<PsiFile> formsBoundToClass = FormClassIndex.findFormsBoundToClass(aClass.getProject(), aClass);
    if (formsBoundToClass.size() > 0) {
      Annotation boundClassAnnotation = holder.createInfoAnnotation(aClass.getNameIdentifier(), null);
      boundClassAnnotation.setGutterIconRenderer(new BoundIconRenderer(aClass));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:FormClassAnnotator.java

示例3: attachColorIcon

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
private static void attachColorIcon(final PsiElement element, AnnotationHolder holder, String attributeValueText) {
  try {
    Color color = null;
    if (attributeValueText.startsWith("#")) {
      color = ColorUtil.fromHex(attributeValueText.substring(1));
    } else {
      final String hexCode = ColorMap.getHexCodeForColorName(StringUtil.toLowerCase(attributeValueText));
      if (hexCode != null) {
        color = ColorUtil.fromHex(hexCode);
      }
    }
    if (color != null) {
      final ColorIcon icon = new ColorIcon(8, color);
      final Annotation annotation = holder.createInfoAnnotation(element, null);
      annotation.setGutterIconRenderer(new ColorIconRenderer(icon, element));
    }
  }
  catch (Exception ignored) {
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaFxAnnotator.java

示例4: annotateIcon

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
private void annotateIcon(PsiElement psiElement, AnnotationHolder annotationHolder, String value) {
    if (IconIndex.getAllAvailableIcons(psiElement.getProject()).contains(value)) {
        annotationHolder.createInfoAnnotation(psiElement, null);
    } else {
        annotationHolder.createWarningAnnotation(psiElement, "Unresolved icon - this may also occur if the icon is defined in your extension, but not in the global icon registry.");
    }
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:8,代码来源:IconAnnotator.java

示例5: annotateTranslation

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
private void annotateTranslation(PsiElement psiElement, AnnotationHolder annotationHolder, String value) {
    if (TranslationUtil.keyExists(psiElement.getProject(), value)) {
        annotationHolder.createInfoAnnotation(psiElement, null);
    } else {
        annotationHolder.createErrorAnnotation(psiElement, "Unresolved translation - this may occur if you defined the translation key only in TypoScript");
    }
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:8,代码来源:TranslationAnnotator.java

示例6: annotate

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder annotationHolder) {
  if (element instanceof SoyTemplateBlock) {
    // Abort if values are passed with data="...", parameter are sometimes defined for the sake
    // of added documentation even when not technically used directly in the template body.
    if (element.getText().contains("data=")) {
      return;
    }

    Collection<Parameter> parameters = ParamUtils.getParamDefinitions(element);

    Collection<String> usedVariableIdentifiers =
        PsiTreeUtil.findChildrenOfType(element, IdentifierElement.class)
            .stream()
            .map(IdentifierElement::getReferences)
            .flatMap(references -> Arrays.stream(references))
            .map(PsiReference::getCanonicalText)
            .filter(id -> id.startsWith("$"))
            .map(id -> id.substring(1))
            .collect(Collectors.toList());

    for (Variable parameter : parameters) {
      boolean isMatched = false;
      for (String usedIdentifier : usedVariableIdentifiers) {
        if (usedIdentifier.startsWith(parameter.name)) {
          isMatched = true;
          break;
        }
      }

      if (!isMatched) {
        annotationHolder.createInfoAnnotation(parameter.element,
            "Parameter " + parameter.name + " is unused.");
      }
    }
  }
}
 
开发者ID:google,项目名称:bamboo-soy,代码行数:38,代码来源:UnusedParameterAnnotator.java

示例7: annotate

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
	if (element instanceof SQFVariable) {
		SQFVariable var = (SQFVariable) element;
		if (var.isMagicVar()) {
			Annotation a = holder.createInfoAnnotation(TextRange.from(element.getTextOffset(), var.getTextLength()), null);
			a.setTextAttributes(SQFSyntaxHighlighter.MAGIC_VAR);
		}
	}
}
 
开发者ID:kayler-renslow,项目名称:arma-intellij-plugin,代码行数:11,代码来源:SQFMagicVarColorizerAnnotator.java

示例8: annotate

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
	String elementText = element.getText();
	if (elementText.length() >= 1 && elementText.charAt(0) == '#') {
		int macroNameEnd = elementText.indexOf(' ');
		Annotation a = holder.createInfoAnnotation(TextRange.from(element.getTextOffset(), macroNameEnd < 0 ? elementText.length() : macroNameEnd), null);
		a.setTextAttributes(HeaderSyntaxHighlighter.PREPROCESSOR);
	}
}
 
开发者ID:kayler-renslow,项目名称:arma-intellij-plugin,代码行数:10,代码来源:PreprocessorColorizerAnnotator.java

示例9: annotate

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
/**
 * The method annotates all nodes which are used in edges but not declared explicitly
 *
 * @param element element you would like to annotate
 * @param holder  annotation holder
 */
@Override
public void annotate(@NotNull final PsiElement element, @NotNull AnnotationHolder holder) {
    if (element instanceof DotDotgraphStmtImpl) {
        for (DotId id : getNotMentionedNodeIds(element)) {
            TextRange range = new TextRange(id.getTextRange().getStartOffset(),
                    id.getTextRange().getEndOffset());
            Annotation annotation = holder.createInfoAnnotation(range, "No such such node specified in graph");
            annotation.setHighlightType(ProblemHighlightType.LIKE_UNUSED_SYMBOL);
        }

    }

}
 
开发者ID:bzixilu,项目名称:dotplugin,代码行数:20,代码来源:DotAnnotator.java

示例10: extractSetValue

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
private void extractSetValue(EndpointValidationResult result, Set<String> validationSet, String fromElement, PsiElement element,
                             AnnotationHolder holder, CamelAnnotatorEndpointMessage msg, boolean lenient) {
    if (validationSet != null && (lenient || !result.isSuccess())) {

        for (String entry : validationSet) {
            String propertyValue = entry;

            int startIdxQueryParameters = fromElement.indexOf("?" + propertyValue);
            startIdxQueryParameters = (startIdxQueryParameters == -1) ? fromElement.indexOf("&" + propertyValue) : fromElement.indexOf("?");

            int propertyIdx = fromElement.indexOf(propertyValue, startIdxQueryParameters);
            int propertyLength = propertyValue.length();

            propertyIdx = getIdeaUtils().isJavaLanguage(element) || getIdeaUtils().isXmlLanguage(element)  ? propertyIdx + 1  : propertyIdx;

            TextRange range = new TextRange(element.getTextRange().getStartOffset() + propertyIdx,
                element.getTextRange().getStartOffset() + propertyIdx + propertyLength);

            if (msg.isInfoLevel()) {
                holder.createInfoAnnotation(range, summaryMessage(result, propertyValue, msg));
            } else if (msg.isWarnLevel()) {
                holder.createWarningAnnotation(range, summaryMessage(result, propertyValue, msg));
            } else {
                holder.createErrorAnnotation(range, summaryMessage(result, propertyValue, msg));
            }
        }
    }
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:29,代码来源:CamelEndpointAnnotator.java

示例11: annotate

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
  if (element instanceof PsiDocTag) {
    String name = ((PsiDocTag)element).getName();
    if ("param".equals(name)) {
      PsiDocTagValue tagValue = ((PsiDocTag)element).getValueElement();
      if (tagValue != null) {
        Annotation annotation = holder.createInfoAnnotation(tagValue, null);
        annotation.setTextAttributes(JavaHighlightingColors.DOC_COMMENT_TAG_VALUE);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JavaDocAnnotator.java

示例12: apply

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
@Override
public void apply(@NotNull PsiFile file, MyInfo[] infos, @NotNull AnnotationHolder holder) {
  if (infos == null || infos.length == 0) {
    return;
  }

  final HighlightDisplayLevel displayLevel = getHighlightDisplayLevel(file);

  for (MyInfo info : infos) {
    if (!info.myResult) {
      final PsiElement element = info.myAnchor.retrieve();
      if (element != null) {
        final int start = element.getTextRange().getStartOffset();
        final TextRange range = new TextRange(start + info.myRangeInElement.getStartOffset(),
                                              start + info.myRangeInElement.getEndOffset());
        final String message = getErrorMessage(info.myUrl);

        final Annotation annotation;

        if (displayLevel == HighlightDisplayLevel.ERROR) {
          annotation = holder.createErrorAnnotation(range, message);
        }
        else if (displayLevel == HighlightDisplayLevel.WARNING) {
          annotation = holder.createWarningAnnotation(range, message);
        }
        else if (displayLevel == HighlightDisplayLevel.WEAK_WARNING) {
          annotation = holder.createInfoAnnotation(range, message);
        }
        else {
          annotation = holder.createWarningAnnotation(range, message);
        }

        for (IntentionAction action : getQuickFixes()) {
          annotation.registerFix(action);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:WebReferencesAnnotatorBase.java

示例13: apply

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
@Override
public void apply(@NotNull PsiFile file, List<HighlightRange> ranges, @NotNull AnnotationHolder holder) {
  for (HighlightRange range : ranges) {
    if (range.getStyleClass().equals("error")) {
      holder.createErrorAnnotation(range.getTextRange(), null);
    }
    else {
      final Annotation infoAnnotation = holder.createInfoAnnotation(range.getTextRange(), null);
      infoAnnotation.setEnforcedTextAttributes(range.getTextAttributes());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:YouTrackHighlightingAnnotator.java

示例14: checkGrDocReferenceElement

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
private static void checkGrDocReferenceElement(AnnotationHolder holder, PsiElement element) {
  ASTNode node = element.getNode();
  if (node != null && TokenSets.BUILT_IN_TYPES.contains(node.getElementType())) {
    Annotation annotation = holder.createInfoAnnotation(element, null);
    annotation.setTextAttributes(GroovySyntaxHighlighter.KEYWORD);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:GroovyAnnotator.java

示例15: setHighlighting

import com.intellij.lang.annotation.AnnotationHolder; //导入方法依赖的package包/类
protected static Annotation setHighlighting(
    @NotNull PsiElement element, @NotNull AnnotationHolder holder,
    @NotNull TextAttributesKey key) {
  Annotation annotation = holder.createInfoAnnotation(element, null);
  annotation.setEnforcedTextAttributes(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key));
  return annotation;
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:8,代码来源:SchemaAnnotatorBase.java


注:本文中的com.intellij.lang.annotation.AnnotationHolder.createInfoAnnotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。