Package com.intellij.openapi.editor.markup

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


        catch (IndexNotReadyException ignored)
        {
        }

        final SimpleTextAttributes regularAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
        TextAttributes textAttributes = regularAttributes.toTextAttributes();
        if (node instanceof BasePsiNode && ((BasePsiNode) node).isDeprecated())
        {
          textAttributes =
            EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES)
              .clone();
        }

        PsiElement psiElement = node.getPsiElement();
        VirtualFile vFile = (psiElement == null)
          ? null
            : ((psiElement instanceof PsiDirectory)
              ? ((PsiDirectory) psiElement).getVirtualFile()
                : (psiElement.getContainingFile() == null) ? null : psiElement.getContainingFile().getVirtualFile());

        String reviewName = scopeTreeViewPanel.getCurrentScopeName();
        if (reviewName == null)
        {
          return;
        }

        Review review = project.getComponent(ReviewManager.class).getReviewByName(reviewName);
        if (review != null)
        {
          FileStatus fileStatus = retrieveFileStatus(review, vFile);
          textAttributes.setForegroundColor(fileStatus.getColor());
        }

        append(node.toString(), SimpleTextAttributes.fromTextAttributes(textAttributes));

        String oldToString = toString();
View Full Code Here


    final EditorColorsManager editorColorsManager =
        EditorColorsManager.getInstance();
    final Editor editor = editorManager.getSelectedTextEditor();
    final EditorColorsScheme globalScheme =
        editorColorsManager.getGlobalScheme();
    final TextAttributes textattributes =
        globalScheme.getAttributes(
            EditorColors.SEARCH_RESULT_ATTRIBUTES);

    assert editor != null;
    assert project != null;
View Full Code Here

    static final String ERROR_NUMBER_ID = "Wrong number";
    @NonNls
    static final String ERROR_UNDEFINED_ID = "Wrong token";

    private static TextAttributes modify(TextAttributesKey key, Color color) {
        TextAttributes attrs = key.getDefaultAttributes().clone();
        attrs.setForegroundColor(color);
        return attrs;
    }
View Full Code Here

        attrs.setForegroundColor(color);
        return attrs;
    }

    private static TextAttributes modify(TextAttributesKey key, Color color, int fontType) {
        TextAttributes attrs = modify(key, color);
        attrs.setFontType(fontType);
        return attrs;
    }
View Full Code Here

    static final Pattern GHCI_PATTERN = Pattern.compile(MODULES + PROMPT_ARROW);

    static void processOutput(LanguageConsoleImpl console, String text, Key<?> attributes) {
        // todo implement multiple cases for error etc.
        console.printToHistory(text, new TextAttributes(null, null, null, null, Font.PLAIN)); // todo: ???
    }
View Full Code Here

    } else if (lineStart >= 0 && lineEnd >= 0) {
      marker = document.createRangeMarker(document.getLineStartOffset(lineStart), document.getLineEndOffset(lineEnd));
    }

    if(marker != null) {
      editor.getMarkupModel().addRangeHighlighter(marker.getStartOffset(), marker.getEndOffset(), HighlighterLayer.FIRST - 1, new TextAttributes(null, null, JBColor.RED, EffectType.BOXED, Font.BOLD), HighlighterTargetArea.EXACT_RANGE);
    }

    return editor;
  }
View Full Code Here

        if (psiElement instanceof PsiAnonymousClass) {
          final PsiElement firstChild = psiElement.getFirstChild();
          annotation = annotationHolder.createWarningAnnotation(firstChild == null ? psiElement : firstChild, getAnnotationText(matchingDescriptors));
          // todo: use color from annotation configuration
          annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.RED.brighter(), EffectType.BOXED, Font.PLAIN));
        } else {
          annotation = annotationHolder.createWarningAnnotation(textRange, getAnnotationText(matchingDescriptors));
          // todo: use color from annotation configuration
          annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.RED, EffectType.WAVE_UNDERSCORE, Font.PLAIN));
        }

        annotation.registerFix(new SuppressReportBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new SuppressReportBugForClassIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearAndSuppressBugIntentionAction(problemDescriptor), textRange);

        break;

      case Detector.NORMAL_PRIORITY:

        if (psiElement instanceof PsiAnonymousClass) {
          final PsiElement firstChild = psiElement.getFirstChild();
          annotation = annotationHolder.createWarningAnnotation(firstChild == null ? psiElement : firstChild, getAnnotationText(matchingDescriptors));
        } else {
          annotation = annotationHolder.createWarningAnnotation(textRange, getAnnotationText(matchingDescriptors));
        }

        // todo: use color from annotation configuration
        annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.YELLOW.darker(), EffectType.WAVE_UNDERSCORE, Font.PLAIN));

        annotation.registerFix(new SuppressReportBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new SuppressReportBugForClassIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearAndSuppressBugIntentionAction(problemDescriptor), textRange);

        break;

      case Detector.EXP_PRIORITY:

        if (problemElement instanceof PsiAnonymousClass) {
          final PsiElement firstChild = psiElement.getFirstChild();
          annotation = annotationHolder.createWarningAnnotation(firstChild == null ? psiElement : firstChild, getAnnotationText(matchingDescriptors));
        } else {
          annotation = annotationHolder.createWarningAnnotation(textRange, getAnnotationText(matchingDescriptors));
        }

        // todo: use color from annotation configuration
        annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.GRAY, EffectType.WAVE_UNDERSCORE, Font.PLAIN));

        annotation.registerFix(new SuppressReportBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new SuppressReportBugForClassIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearAndSuppressBugIntentionAction(problemDescriptor), textRange);

        break;
      case Detector.LOW_PRIORITY:

        if (psiElement instanceof PsiAnonymousClass) {
          final PsiElement firstChild = psiElement.getFirstChild();
          annotation = annotationHolder.createInfoAnnotation(firstChild == null ? psiElement : firstChild, getAnnotationText(matchingDescriptors));
        } else {
          annotation = annotationHolder.createInfoAnnotation(textRange, getAnnotationText(matchingDescriptors));
        }

        // todo: use color from annotation configuration
        annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.GREEN, EffectType.WAVE_UNDERSCORE, Font.PLAIN));

        annotation.registerFix(new SuppressReportBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new SuppressReportBugForClassIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearAndSuppressBugIntentionAction(problemDescriptor), textRange);

        break;
      case Detector.IGNORE_PRIORITY:
        if (problemElement instanceof PsiAnonymousClass) {
          final PsiElement firstChild = psiElement.getFirstChild();
          annotation = annotationHolder.createWarningAnnotation(firstChild == null ? psiElement : firstChild, getAnnotationText(matchingDescriptors));
          annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.MAGENTA.brighter(), EffectType.WAVE_UNDERSCORE, Font.PLAIN));
        } else {
          annotation = annotationHolder.createWarningAnnotation(textRange, getAnnotationText(matchingDescriptors));
        }

        // todo: use color from annotation configuration
        annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.MAGENTA, EffectType.WAVE_UNDERSCORE, Font.PLAIN));

        annotation.registerFix(new SuppressReportBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new SuppressReportBugForClassIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearAndSuppressBugIntentionAction(problemDescriptor), textRange);
View Full Code Here

            final Set<SonarIssue> issuesOfHighlighter = rangeHighlighterAtLine.get().getUserData(KEY);
            if (null != issuesOfHighlighter) {
              issuesOfHighlighter.add(issue);
            }
          } else {
            TextAttributes attrs = new TextAttributes();
//            uncomment to make visible
//            attrs.setForegroundColor(JBColor.BLUE);
            final RangeHighlighter rangeHighlighter = markupModel.addRangeHighlighter(
                textRange.getStartOffset(),
                textRange.getEndOffset(),
View Full Code Here

            // und erstellen
            if (highlightText != null) {
                // text durchsuchen
                String text = editor.getDocument().getText();
                // textAttribute für RangeHighlighter holen
                final TextAttributes textAttributes = editor.getColorsScheme().getAttributes(BWACColorSettingsPage.BROWSEWORDATCARET);

                int index = -1;
                do {
                    index = text.indexOf(highlightText, index + 1);
                    // wenn gefunden und ganzes wort -> aufnehmen
View Full Code Here

        }
        catch (IndexNotReadyException ignore)
        {
        }
        final SimpleTextAttributes regularAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
        TextAttributes textAttributes = regularAttributes.toTextAttributes();
        if (node instanceof BasePsiNode && ((BasePsiNode) node).isDeprecated())
        {
          textAttributes =
            EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES)
              .clone();
        }

        PsiElement psiElement = node.getPsiElement();
        VirtualFile vFile = (psiElement == null)
          ? null
            : ((psiElement instanceof PsiDirectory)
              ? ((PsiDirectory) psiElement).getVirtualFile()
                : (psiElement.getContainingFile() == null) ? null : psiElement.getContainingFile().getVirtualFile());

        String reviewName = scopeTreeViewPanel.CURRENT_SCOPE_NAME;
        if (reviewName == null)
        {
          return;
        }

        Review review = project.getComponent(ReviewManager.class).getReviewByName(reviewName);
        if (review != null)
        {
          FileStatus fileStatus = retrieveFileStatus(review, vFile);
          textAttributes.setForegroundColor(fileStatus.getColor());
        }

        append(node.toString(), SimpleTextAttributes.fromTextAttributes(textAttributes));

        String oldToString = toString();
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.