Package com.intellij.openapi.editor.markup

Examples of com.intellij.openapi.editor.markup.TextAttributes$Externalizable


public class TextAttributesUtil {
   
    public static SimpleTextAttributes getSimpleTextAttributes(TextAttributesKey textAttributesKey) {
        EditorColorsManager colorManager = EditorColorsManager.getInstance();
        TextAttributes textAttributes = colorManager.getGlobalScheme().getAttributes(textAttributesKey);
        return new SimpleTextAttributes(
                textAttributes.getBackgroundColor(),
                textAttributes.getForegroundColor(),
                textAttributes.getEffectColor(),
                textAttributes.getFontType());
    }
View Full Code Here


  private int getColorForElementType(IElementType element, SyntaxHighlighter hl, EditorColorsScheme colorScheme) {
    int color = colorScheme.getDefaultForeground().getRGB();
    Color tmp;
    TextAttributesKey[] attributes = hl.getTokenHighlights(element);
    for(TextAttributesKey attribute : attributes) {
      TextAttributes attr = colorScheme.getAttributes(attribute);
      if(attr != null) {
        tmp = attr.getForegroundColor();
        if(tmp != null) color = tmp.getRGB();
      }
    }

    return color;
View Full Code Here

  }

  private static void applyHighlights(Project project, Editor grammarEditor, Set<TextRange> trueRanges, Set<TextRange> falseRanges) {
    if (grammarEditor.isDisposed()) return;
    EditorColorsManager manager = EditorColorsManager.getInstance();
    TextAttributes trueAttrs = manager.getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
    TextAttributes falseAttrs = manager.getGlobalScheme().getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES);

    HighlightManagerImpl highlightManager = (HighlightManagerImpl)HighlightManager.getInstance(project);
    highlightManager.hideHighlights(grammarEditor, HighlightManager.HIDE_BY_ESCAPE | HighlightManager.HIDE_BY_ANY_KEY);
    for (TextRange range : trueRanges) {
      highlightManager.addRangeHighlight(grammarEditor, range.getStartOffset(), range.getEndOffset(), trueAttrs, true, null);
View Full Code Here

    final CompositeAppearance oldText = myHighlightedText;

    myHighlightedText = new CompositeAppearance();

    TextAttributes classNameAttributes = null;
    if (myColor != null) {
      classNameAttributes = new TextAttributes(myColor, null, null, null, Font.PLAIN);
    }

    final String libraryName = DartResolveUtil.getLibraryName(dartClass.getContainingFile());
    myHighlightedText.getEnding().addText(dartClass.getName(), classNameAttributes);
    myHighlightedText.getEnding().addText(" (" + libraryName + ")", HierarchyNodeDescriptor.getPackageNameAttributes());
View Full Code Here

    return pane;
  }

  @NotNull
  private static Color getTextForeground(@NotNull EditorColorsScheme colorsScheme) {
    TextAttributes textAttributes = colorsScheme.getAttributes(ConsoleViewContentType.ERROR_OUTPUT_KEY);
    if (textAttributes != null && textAttributes.getForegroundColor() != null) {
      return textAttributes.getForegroundColor();
    }
    return UIUtil.getLabelForeground();
  }
View Full Code Here

        CodeInsightColors.FOLLOWED_HYPERLINK_ATTRIBUTES
      };
    }
    EditorColorsScheme colorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
    for (TextAttributesKey key : keys) {
      TextAttributes textAttributes = colorsScheme.getAttributes(key);
      if (textAttributes != null && textAttributes.getBackgroundColor() != null) {
        return textAttributes.getBackgroundColor();
      }
    }
    return UIUtil.getOptionPaneBackground();
  }
View Full Code Here

    final int textStartOffset = entireLength - line.length();
    final int highlightStartOffset = textStartOffset + m.start(numberOfReferenceGroup);
    final int highlightEndOffset = textStartOffset + m.end(numberOfReferenceGroup);
    final OpenFileHyperlinkInfo info = new OpenFileHyperlinkInfo(myProject, vFile.get(), lineNumber);

    TextAttributes attributes = HYPERLINK_ATTRIBUTES.clone();
    if (!ProjectRootManager.getInstance(myProject).getFileIndex().isInContent(vFile.get())) {
      Color color = UIUtil.getInactiveTextColor();
      attributes.setForegroundColor(color);
      attributes.setEffectColor(color);
    }
    return new Result(highlightStartOffset, highlightEndOffset, info, attributes);
  }
View Full Code Here

    });
  }

  private static ConsoleViewContentType getOutputAttributes(String userName) {
    return new ConsoleViewContentType("UserName",
        new TextAttributes(getColor(userName), Color.white, Color.white, null, Font.BOLD)) {
    };
  }
View Full Code Here

    super(messageText, new Date());
  }

  protected ConsoleViewContentType getTextAttributes() {
    return new ConsoleViewContentType("SelfText",
        new TextAttributes(new JBColor(Gray._100, Gray._140), UIUtil.getListBackground(), UIUtil.getListBackground(), null, Font.PLAIN)) {
    };
  }
View Full Code Here

        }

        private void highlight(Project project, Editor editor, GoLiteralIdentifier identifierToInline) {
            HighlightManager manager = HighlightManager.getInstance(project);
            EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
            TextAttributes attributes = scheme.getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
            TextAttributes writeAttributes = scheme.getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES);
            manager.addOccurrenceHighlights(editor, readUsages, attributes, true, null);
            manager.addOccurrenceHighlights(editor, writeUsages, writeAttributes, true, null);
            manager.addOccurrenceHighlights(editor, new PsiElement[]{identifierToInline}, writeAttributes, true, null);
        }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.editor.markup.TextAttributes$Externalizable

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.