本文整理匯總了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));
}
}
}
示例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) {
}
}
示例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.");
}
}
示例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");
}
}
示例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.");
}
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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));
}
}
}
}
示例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);
}
}
}
}
示例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);
}
}
}
}
}
示例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());
}
}
}
示例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);
}
}
示例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;
}