本文整理匯總了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);
}
}
}