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


Java HaxeSyntaxHighlighterColors类代码示例

本文整理汇总了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;
  }
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:27,代码来源:HaxeColorAnnotator.java

示例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;
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:8,代码来源:HaxeExpressionEvaluatorContext.java

示例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);
  }
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:16,代码来源:HaxeColorAnnotator.java

示例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);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:32,代码来源:HaxeColorAnnotator.java

示例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);
    }
  }
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:48,代码来源:HaxeColorAnnotator.java


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