Java Code Examples for com.intellij.ui.JBColor#GRAY

The following examples show how to use com.intellij.ui.JBColor#GRAY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilterDropDown.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
protected void enableDropDown(final boolean isTeamServicesRepository) {
    final JBColor color;
    if (isTeamServicesRepository) {
        addListeners();
        color = JBColor.BLACK;

    } else {
        removeListeners();
        color = JBColor.GRAY;
    }

    // update color on UI thread
    IdeaHelper.runOnUIThread(new Runnable() {
        @Override
        public void run() {
            pickerLabel.setForeground(color);
        }
    });

    isEnabled = isTeamServicesRepository;
}
 
Example 2
Source File: HTMLTextPainter.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void writeHeader(@NonNls Writer writer, String title) throws IOException {
  EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  writer.write("<html>\r\n");
  writer.write("<head>\r\n");
  writer.write("<title>" + title + "</title>\r\n");
  writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n");
  writeStyles(writer);
  writer.write("</head>\r\n");
  Color color = scheme.getDefaultBackground();
  if (color==null) color = JBColor.GRAY;
  writer.write("<BODY BGCOLOR=\"#" + Integer.toString(color.getRGB() & 0xFFFFFF, 16) + "\">\r\n");
  writer.write("<TABLE CELLSPACING=0 CELLPADDING=5 COLS=1 WIDTH=\"100%\" BGCOLOR=\"#C0C0C0\" >\r\n");
  writer.write("<TR><TD><CENTER>\r\n");
  writer.write("<FONT FACE=\"Arial, Helvetica\" COLOR=\"#000000\">\r\n");
  writer.write(title + "</FONT>\r\n");
  writer.write("</center></TD></TR></TABLE>\r\n");
  writer.write("<pre>\r\n");
}
 
Example 3
Source File: LineParser.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static Object toStyle(String str) {
  switch (str) {
    case "1":
      return SimpleTextAttributes.STYLE_BOLD;
    case "3":
      return SimpleTextAttributes.STYLE_ITALIC;
    case "4":
      return SimpleTextAttributes.STYLE_UNDERLINE;
    case "9":
      return SimpleTextAttributes.STYLE_STRIKEOUT;
    case "30":
      return JBColor.BLACK;
    case "31":
      return JBColor.RED;
    case "32":
      return JBColor.GREEN;
    case "33":
      return JBColor.YELLOW;
    case "34":
      return JBColor.BLUE;
    case "35":
      return JBColor.MAGENTA;
    case "36":
      return JBColor.CYAN;
    case "37":
      return JBColor.WHITE;
    case "38":
      return JBColor.GRAY;
    default:
      return null;
  }
}
 
Example 4
Source File: EditorPerfDecorations.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
Color getErrorStripeMarkColor() {
  // TODO(jacobr): tween from green or blue to red depending on the count.
  final int count = getDisplayValue();
  if (count == 0) {
    return null;
  }
  if (count >= Icons.HIGH_LOAD_THRESHOLD) {
    return JBColor.YELLOW;
  }
  return JBColor.GRAY;
}
 
Example 5
Source File: LineParser.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static Object toStyle(String str) {
  switch (str) {
    case "1":
      return SimpleTextAttributes.STYLE_BOLD;
    case "3":
      return SimpleTextAttributes.STYLE_ITALIC;
    case "4":
      return SimpleTextAttributes.STYLE_UNDERLINE;
    case "9":
      return SimpleTextAttributes.STYLE_STRIKEOUT;
    case "30":
      return JBColor.BLACK;
    case "31":
      return JBColor.RED;
    case "32":
      return JBColor.GREEN;
    case "33":
      return JBColor.YELLOW;
    case "34":
      return JBColor.BLUE;
    case "35":
      return JBColor.MAGENTA;
    case "36":
      return JBColor.CYAN;
    case "37":
      return JBColor.WHITE;
    case "38":
      return JBColor.GRAY;
    default:
      return null;
  }
}
 
Example 6
Source File: EditorPerfDecorations.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
Color getErrorStripeMarkColor() {
  // TODO(jacobr): tween from green or blue to red depending on the count.
  final int count = getDisplayValue();
  if (count == 0) {
    return null;
  }
  if (count >= Icons.HIGH_LOAD_THRESHOLD) {
    return JBColor.YELLOW;
  }
  return JBColor.GRAY;
}
 
Example 7
Source File: AbstractBashSyntaxHighlighterTest.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
protected void doLexerHighlightingTest(String fileContent, IElementType targetElementType) {
    BashSyntaxHighlighter syntaxHighlighter = new BashSyntaxHighlighter();
    TextAttributesKey[] keys = syntaxHighlighter.getTokenHighlights(targetElementType);
    Assert.assertEquals("Expected one key", 1, keys.length);

    TextAttributesKey attributesKey = keys[0];
    Assert.assertNotNull(attributesKey);

    EditorColorsManager manager = EditorColorsManager.getInstance();
    EditorColorsScheme scheme = (EditorColorsScheme) manager.getGlobalScheme().clone();
    manager.addColorsScheme(scheme);
    EditorColorsManager.getInstance().setGlobalScheme(scheme);

    TextAttributes targetAttributes = new TextAttributes(JBColor.RED, JBColor.BLUE, JBColor.GRAY, EffectType.BOXED, Font.BOLD);
    scheme.setAttributes(attributesKey, targetAttributes);

    myFixture.configureByText(BashFileType.BASH_FILE_TYPE, fileContent);

    TextAttributes actualAttributes = null;
    HighlighterIterator iterator = ((EditorImpl) myFixture.getEditor()).getHighlighter().createIterator(0);
    while (!iterator.atEnd()) {
        if (iterator.getTokenType() == targetElementType) {
            actualAttributes = iterator.getTextAttributes();
            break;
        }

        iterator.advance();
    }

    Assert.assertEquals("Expected text attributes for " + attributesKey, targetAttributes, actualAttributes);
}
 
Example 8
Source File: FileColorConfigurationEditDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Color getForeground() {
  if (getModel().isSelected()) {
    return JBColor.foreground();
  }
  else if (getModel().isRollover()) {
    return JBColor.GRAY;
  }
  else {
    return getColor();
  }
}
 
Example 9
Source File: HighlightDisplayLevel.java    From consulo with Apache License 2.0 4 votes vote down vote up
public SingleColorIcon(final TextAttributesKey key) {
  super(getEmptyIconDim(), JBColor.GRAY, false);
  myKey = key;
}
 
Example 10
Source File: ProjectStructureElementRenderer.java    From consulo with Apache License 2.0 4 votes vote down vote up
@RequiredUIAccess
@Override
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  if (value instanceof MasterDetailsComponent.MyNode) {
    final MasterDetailsComponent.MyNode node = (MasterDetailsComponent.MyNode)value;

    final NamedConfigurable namedConfigurable = node.getConfigurable();
    if (namedConfigurable == null) {
      return;
    }

    final String displayName = node.getDisplayName();
    final Image icon = namedConfigurable.getIcon(expanded);
    setIcon(icon);
    setToolTipText(null);
    setFont(UIUtil.getTreeFont());

    SimpleTextAttributes textAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
    if (node.isDisplayInBold()) {
      textAttributes = SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
    }
    else if (namedConfigurable instanceof ProjectStructureElementConfigurable) {
      final ProjectStructureElement projectStructureElement =
        ((ProjectStructureElementConfigurable)namedConfigurable).getProjectStructureElement();
      if (projectStructureElement != null) {
        final ProjectStructureDaemonAnalyzer daemonAnalyzer = myContext == null ? null : myContext.getDaemonAnalyzer();
        final ProjectStructureProblemsHolderImpl problemsHolder = daemonAnalyzer == null ? null : daemonAnalyzer.getProblemsHolder(projectStructureElement);
        if (problemsHolder != null && problemsHolder.containsProblems()) {
          final boolean isUnused = problemsHolder.containsProblems(ProjectStructureProblemType.Severity.UNUSED);
          final boolean haveWarnings = problemsHolder.containsProblems(ProjectStructureProblemType.Severity.WARNING);
          final boolean haveErrors = problemsHolder.containsProblems(ProjectStructureProblemType.Severity.ERROR);
          Color foreground = isUnused ? UIUtil.getInactiveTextColor() : null;
          final int style = haveWarnings || haveErrors ? SimpleTextAttributes.STYLE_WAVED : -1;
          final Color waveColor = haveErrors ? JBColor.RED : haveWarnings ? JBColor.GRAY : null;
          textAttributes = textAttributes.derive(style, foreground, null, waveColor);
          setToolTipText(problemsHolder.composeTooltipMessage());
        }

        append(displayName, textAttributes);
        String description = projectStructureElement.getDescription();
        if (description != null) {
          append(" (" + description + ")", SimpleTextAttributes.GRAY_ATTRIBUTES, false);
        }
        return;
      }
    }
    append(displayName, textAttributes);
  }
}
 
Example 11
Source File: FileColorConfigurationEditDialog.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Color getForeground() {
  return getModel().isSelected() ? Color.BLACK : JBColor.GRAY;
}
 
Example 12
Source File: DependencyViewer.java    From gradle-view with Apache License 2.0 4 votes vote down vote up
public DependencyViewer(Project p, ToolWindow t) {
    super(true, true);
    this.project = p;
    this.toolWindow = t;
    this.splitter = new Splitter(false, 0.75f);
    this.information = new JTextArea();
    this.toolingLogger = initToolingLogger();

    this.dependencyCellRenderer = new DependencyCellRenderer();
    this.dependencyCellRenderer.omittedSelected = JBColor.MAGENTA;
    this.dependencyCellRenderer.omittedUnselected = JBColor.GRAY;
    this.dependencyCellRenderer.normalSelected = JBColor.foreground();
    this.dependencyCellRenderer.normalUnselected = JBColor.BLACK;
    this.information.setEditable(false);

    this.shouldPromptForCurrentProject = true;

    // TODO clean all of this up
    GradleService gradleService = ServiceManager.getService(project, GradleService.class);
    gradleService.addListener(new ViewActionListener() {
        @Override
        public void refresh() {
            // prompt only on first use of tool panel
            if (shouldPromptForCurrentProject) {
                // ask to initialize view for this project to the current project
                if (useCurrentProjectBuild()) {
                    gradleBaseDir = project.getBasePath();
                }
                shouldPromptForCurrentProject = false;
            }

            // there's nothing to do when there is no gradleBaseDir set, instead issue a prompt
            if(gradleBaseDir == null) {
                promptForGradleBaseDir();
            }

            // initialize an empty view even if the gradleBaseDir is set while we load everything in the background
            updateView(null, null);

            new SwingWorker<GradleNode, Void>() {
                protected GradleNode doInBackground() throws Exception {
                    try {
                        Map<String, GradleNode> dependencyMap = loadProjectDependenciesFromModel(gradleBaseDir, toolingLogger);
                        GradleNode rootDependency = dependencyMap.get("root");

                        GradleNode target = dependencyCellRenderer.selectedGradleNode;
                        GradleNode selectedDependency;
                        if(target != null && target.group != null) {
                            selectedDependency = target;
                        } else {
                            selectedDependency = new GradleNode("No dependency selected");
                        }

                        updateView(rootDependency, selectedDependency);
                        return rootDependency;
                    } catch(Exception e) {
                        e.printStackTrace();
                        toolingLogger.log(ExceptionUtils.getFullStackTrace(e));
                        throw new RuntimeException(e);
                    }
                }
            }.execute();
        }

        @Override
        public void toggleShowReplaced() {
            dependencyCellRenderer.showReplaced = !dependencyCellRenderer.showReplaced;
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    splitter.repaint();
                    splitter.validate();
                }
            });
        }

        @Override
        public void reset() {
            gradleBaseDir = null;
            refresh();
        }
    });
    gradleService.refresh();

    setContent(splitter);
    final ActionManager actionManager = ActionManager.getInstance();
    ActionToolbar actionToolbar = actionManager.createActionToolbar("Gradle View Toolbar",
            (DefaultActionGroup)actionManager.getAction("GradleView.NavigatorActionsToolbar"), true);

    actionToolbar.setTargetComponent(splitter);
    setToolbar(actionToolbar.getComponent());
}
 
Example 13
Source File: UnusedEntrySeveritiesProvider.java    From idea-gitignore with MIT License 2 votes vote down vote up
/**
 * Defines color of the matched entry.
 *
 * @param textAttributes current attribute
 * @return entry color
 */
@Override
public Color getTrafficRendererColor(@NotNull TextAttributes textAttributes) {
    return JBColor.GRAY;
}