本文整理汇总了Java中com.intellij.plugins.haxe.ide.highlight.HaxeSyntaxHighlighterColors类的典型用法代码示例。如果您正苦于以下问题:Java HaxeSyntaxHighlighterColors类的具体用法?Java HaxeSyntaxHighlighterColors怎么用?Java HaxeSyntaxHighlighterColors使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HaxeSyntaxHighlighterColors类属于com.intellij.plugins.haxe.ide.highlight包,在下文中一共展示了HaxeSyntaxHighlighterColors类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAttributeByType
import com.intellij.plugins.haxe.ide.highlight.HaxeSyntaxHighlighterColors; //导入依赖的package包/类
@Nullable
private static TextAttributesKey getAttributeByType(@Nullable HaxeComponentType type, boolean isStatic) {
if (type == null) {
return null;
}
switch (type) {
case CLASS:
case ENUM:
case TYPEDEF:
return TextAttributesKey.find(HaxeSyntaxHighlighterColors.HAXE_CLASS);
case INTERFACE:
return TextAttributesKey.find(HaxeSyntaxHighlighterColors.HAXE_INTERFACE);
case PARAMETER:
return TextAttributesKey.find(HaxeSyntaxHighlighterColors.HAXE_PARAMETER);
case VARIABLE:
return TextAttributesKey.find(HaxeSyntaxHighlighterColors.HAXE_LOCAL_VARIABLE);
case FIELD:
if (isStatic) return TextAttributesKey.find(HaxeSyntaxHighlighterColors.HAXE_STATIC_MEMBER_VARIABLE);
return TextAttributesKey.find(HaxeSyntaxHighlighterColors.HAXE_INSTANCE_MEMBER_VARIABLE);
case METHOD:
if (isStatic) return TextAttributesKey.find(HaxeSyntaxHighlighterColors.HAXE_STATIC_MEMBER_FUNCTION);
return TextAttributesKey.find(HaxeSyntaxHighlighterColors.HAXE_INSTANCE_MEMBER_FUNCTION);
default:
return null;
}
}
示例2: addUnreachable
import com.intellij.plugins.haxe.ide.highlight.HaxeSyntaxHighlighterColors; //导入依赖的package包/类
@NotNull
public Annotation addUnreachable(PsiElement element) {
if (holder == null) return createDummyAnnotation();
Annotation annotation = holder.createInfoAnnotation(element, null);
annotation.setTextAttributes(HaxeSyntaxHighlighterColors.LINE_COMMENT);
return annotation;
}
示例3: annotateCompilationExpression
import com.intellij.plugins.haxe.ide.highlight.HaxeSyntaxHighlighterColors; //导入依赖的package包/类
private static void annotateCompilationExpression(PsiElement node, AnnotationHolder holder) {
final Set<String> definitions = HaxeProjectSettings.getInstance(node.getProject()).getUserCompilerDefinitionsAsSet();
final String nodeText = node.getText();
for (Pair<String, Integer> pair : HaxeStringUtil.getWordsWithOffset(nodeText)) {
final String word = pair.getFirst();
final int offset = pair.getSecond();
final int absoluteOffset = node.getTextOffset() + offset;
final TextRange range = new TextRange(absoluteOffset, absoluteOffset + word.length());
final Annotation annotation = holder.createInfoAnnotation(range, null);
final String attributeName = definitions.contains(word) ? HaxeSyntaxHighlighterColors.HAXE_DEFINED_VAR
: HaxeSyntaxHighlighterColors.HAXE_UNDEFINED_VAR;
annotation.setTextAttributes(TextAttributesKey.find(attributeName));
annotation.registerFix(new HaxeDefineIntention(word, definitions.contains(word)), range);
}
}
示例4: annotate
import com.intellij.plugins.haxe.ide.highlight.HaxeSyntaxHighlighterColors; //导入依赖的package包/类
@Override
public void annotate(@NotNull PsiElement node, @NotNull AnnotationHolder holder) {
if (isNewOperator(node)) {
holder.createInfoAnnotation(node, null).setTextAttributes(TextAttributesKey.find(HaxeSyntaxHighlighterColors.HAXE_KEYWORD));
}
PsiElement element = node;
if (element instanceof HaxeReference) {
final boolean chain = PsiTreeUtil.getChildOfType(element, HaxeReference.class) != null;
if (chain) {
tryAnnotateQName(node, holder);
return;
}
element = ((HaxeReference)element).resolve();
}
if (element instanceof HaxeComponentName) {
final boolean isStatic = checkStatic(element.getParent());
final TextAttributesKey attribute = getAttributeByType(HaxeComponentType.typeOf(element.getParent()), isStatic);
if (attribute != null) {
holder.createInfoAnnotation(node, null).setTextAttributes(attribute);
}
}
final ASTNode astNode = node.getNode();
if (astNode != null) {
IElementType tt = astNode.getElementType();
if (tt == HaxeTokenTypeSets.PPEXPRESSION) {
annotateCompilationExpression(node, holder);
}
}
}
示例5: annotate
import com.intellij.plugins.haxe.ide.highlight.HaxeSyntaxHighlighterColors; //导入依赖的package包/类
@Override
public void annotate(@NotNull PsiElement node, @NotNull AnnotationHolder holder) {
if (isNewOperator(node)) {
holder.createInfoAnnotation(node, null).setTextAttributes(TextAttributesKey.find(HaxeSyntaxHighlighterColors.HAXE_KEYWORD));
}
PsiElement element = node;
if (element instanceof HaxeStringLiteralExpression) {
return;
}
if (element instanceof HaxeReference) {
final boolean chain = PsiTreeUtil.getChildOfType(element, HaxeReference.class) != null;
if (chain) {
if (tryAnnotateQName(node, holder)) return;
}
element = ((HaxeReference)element).resolveToComponentName();
}
if (element instanceof HaxeComponentName) {
final boolean isStatic = PsiTreeUtil.getParentOfType(node, HaxeImportStatement.class) == null && checkStatic(element.getParent());
final TextAttributesKey attribute = getAttributeByType(HaxeComponentType.typeOf(element.getParent()), isStatic);
if (attribute != null) {
if (node instanceof HaxeReference) {
element = ((HaxeReference)node).getReferenceNameElement();
if (element != null) node = element;
}
holder.createInfoAnnotation(node, null).setTextAttributes(attribute);
}
}
if (isKeyword(element)) {
TextAttributesKey attributesKey = TextAttributesKey.find(HaxeSyntaxHighlighterColors.HAXE_KEYWORD);
holder.createInfoAnnotation(node, null).setTextAttributes(attributesKey);
}
final ASTNode astNode = node.getNode();
if (astNode != null) {
IElementType tt = astNode.getElementType();
if (tt == HaxeTokenTypeSets.PPEXPRESSION) {
//annotateCompilationExpression(node, holder);
//FIXME Temporary override:
holder.createInfoAnnotation(node, null).setTextAttributes(HaxeSyntaxHighlighterColors.DEFINED_VAR);
}
if (tt == HaxeTokenTypeSets.PPBODY) {
holder.createInfoAnnotation(node, null).setTextAttributes(HaxeSyntaxHighlighterColors.CONDITIONALLY_NOT_COMPILED);
}
}
}