Package com.intellij.openapi.editor.colors

Examples of com.intellij.openapi.editor.colors.TextAttributesKey


    public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
        return pack(getAttributeKeys(tokenType, backgrounds), getAttributeKeys(tokenType, colors));
    }

    private TextAttributesKey getAttributeKeys(IElementType tokenType, Map<IElementType, TextAttributesKey> map) {
        TextAttributesKey attributes = map.get(tokenType);
        if (attributes == null && tokenType instanceof JFlexElementType) {
            return map.get(((JFlexElementType) tokenType).getParsedType());
        }
        return map.get(tokenType);
    }
View Full Code Here


      }
      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();
View Full Code Here

  private static void tryAnnotateQName(PsiElement node, AnnotationHolder holder) {
    // Maybe this is class name
    final HaxeClass resultClass = HaxeResolveUtil.tryResolveClassByQName(node);
    if (resultClass != null) {
      final TextAttributesKey attribute = getAttributeByType(HaxeComponentType.typeOf(resultClass), false);
      if (attribute != null) {
        holder.createInfoAnnotation(node, null).setTextAttributes(attribute);
      }
    }
  }
View Full Code Here

    public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
        return pack(getAttributeKeys(tokenType, backgrounds), getAttributeKeys(tokenType, colors));
    }

    private TextAttributesKey getAttributeKeys(IElementType tokenType, Map<IElementType, TextAttributesKey> map) {
        TextAttributesKey attributes = map.get(tokenType);
//        if (attributes == null && tokenType instanceof StoryElementType) {
//            return map.get(((StoryElementType) tokenType).getParsedType());
//        }
        return map.get(tokenType);
    }
View Full Code Here

        createInfoAnnotation(holder, element, DartSyntaxHighlighterColors.DART_BUILTIN);
      }
      else {
        final boolean isStatic = isStatic(componentName.getParent());
        final boolean isTopLevel = !isStatic && isTopLevel(componentName.getParent());
        final TextAttributesKey attribute = getDeclarationAttributeByType(DartComponentType.typeOf(componentName.getParent()), isStatic,
                                                                          isTopLevel);
        createInfoAnnotation(holder, element, attribute);
      }
    }
    else {
View Full Code Here

  private static void highlightEscapeSequences(final PsiElement node, final AnnotationHolder holder) {
    final List<Pair<TextRange, Boolean>> escapeSequenceRangesAndValidity = getEscapeSequenceRangesAndValidity(node.getText());
    for (Pair<TextRange, Boolean> rangeAndValidity : escapeSequenceRangesAndValidity) {
      final TextRange range = rangeAndValidity.first.shiftRight(node.getTextRange().getStartOffset());
      final TextAttributesKey attribute = rangeAndValidity.second ? DartSyntaxHighlighterColors.VALID_STRING_ESCAPE
                                                                  : DartSyntaxHighlighterColors.INVALID_STRING_ESCAPE;
      if (rangeAndValidity.second) {
        holder.createInfoAnnotation(range, null).setTextAttributes(attribute);
      }
      else {
View Full Code Here

        for (Annotation annotation : holder) {
            if (annotation.getSeverity() != HighlightSeverity.INFORMATION) {
                continue;
            }

            TextAttributesKey tak = annotation.getTextAttributes();
            if (!keys.contains(tak)) {
                continue;
            }

            String tokenText = document.getText(new TextRange(annotation.getStartOffset(), annotation.getEndOffset()));
            if (pos > annotation.getStartOffset()) {
                int line = document.getLineNumber(annotation.getStartOffset()) + 1;
                fail(String.format("Token \"%s\" at line %d was highlighted multiple times.", tokenText, line));
            }

            sb.append(document.getText(new TextRange(pos, annotation.getStartOffset())))
                    .append("/*begin*/")
                    .append(tokenText)
                    .append("/*end.")
                    .append(tak.getExternalName())
                    .append("*/");
            pos = annotation.getEndOffset();
        }
        sb.append(document.getText(new TextRange(pos, document.getTextLength())));
        return sb.toString();
View Full Code Here

    }

    @Override
    public void visitVarDeclaration(GoVarDeclaration declaration) {
        super.visitVarDeclaration(declaration);
        TextAttributesKey type = GoSyntaxHighlighter.VARIABLE;

        if (psiElement(GoVarDeclarations.class)
            .withParent(psiElement(GoFile.class))
            .accepts(declaration.getParent())) {
            type = GoSyntaxHighlighter.GLOBAL_VARIABLE;
View Full Code Here

        setHighlighting(o.getQAtom(), annotationHolder, ErlangSyntaxHighlighter.FUNCTION);
      }

      @Override
      public void visitFunctionCallExpression(@NotNull ErlangFunctionCallExpression o) {
        TextAttributesKey key = o.getParent() instanceof ErlangGuard ? ErlangSyntaxHighlighter.GUARD : ErlangSyntaxHighlighter.FUNCTION_CALL;
        markCall(o.getQAtom(), annotationHolder, key);
      }

      @Override
      public void visitGenericFunctionCallExpression(@NotNull ErlangGenericFunctionCallExpression o) {
View Full Code Here

    }
    return simpleTextAttributes;
  }

  public static SimpleTextAttributes getSimpleTextAttributes(final ItemPresentation presentation) {
    final TextAttributesKey textAttributesKey = presentation.getTextAttributesKey();
    if (textAttributesKey == null) return SimpleTextAttributes.REGULAR_ATTRIBUTES;
    final TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(textAttributesKey);
    return textAttributes == null ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.fromTextAttributes(textAttributes);
  }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.editor.colors.TextAttributesKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.