Java Code Examples for com.intellij.ui.JBColor#red()

The following examples show how to use com.intellij.ui.JBColor#red() . 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: FlutterLogColors.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@NotNull
public static Color forCategory(@NotNull String category) {
  if (category.equals(ERROR_CATEGORY)) {
    return JBColor.red;
  }
  if (category.startsWith("flutter.")) {
    return JBColor.gray;
  }
  if (category.startsWith("runtime.")) {
    return UIUtil.isUnderDarcula() ? JBColor.magenta : JBColor.pink;
  }
  if (category.equals("http")) {
    return JBColor.blue;
  }

  // TODO(pq): add more presets.

  // Default.
  return JBColor.darkGray;
}
 
Example 2
Source File: FlutterLogColors.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@NotNull
public static Color forCategory(@NotNull String category) {
  if (category.equals(ERROR_CATEGORY)) {
    return JBColor.red;
  }
  if (category.startsWith("flutter.")) {
    return JBColor.gray;
  }
  if (category.startsWith("runtime.")) {
    return UIUtil.isUnderDarcula() ? JBColor.magenta : JBColor.pink;
  }
  if (category.equals("http")) {
    return JBColor.blue;
  }

  // TODO(pq): add more presets.

  // Default.
  return JBColor.darkGray;
}
 
Example 3
Source File: NavBarPresentation.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected SimpleTextAttributes getTextAttributes(final Object object, final boolean selected) {
  if (!NavBarModel.isValid(object)) return SimpleTextAttributes.REGULAR_ATTRIBUTES;
  if (object instanceof PsiElement) {
    if (!ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
      @Override
      public Boolean compute() {
        return ((PsiElement)object).isValid();
      }
    }).booleanValue()) {
      return SimpleTextAttributes.GRAYED_ATTRIBUTES;
    }
    PsiFile psiFile = ((PsiElement)object).getContainingFile();
    if (psiFile != null) {
      final VirtualFile virtualFile = psiFile.getVirtualFile();
      return new SimpleTextAttributes(null, selected ? null : FileStatusManager.getInstance(myProject).getStatus(virtualFile).getColor(), JBColor.red,
                                      WolfTheProblemSolver.getInstance(myProject).isProblemFile(virtualFile) ? SimpleTextAttributes.STYLE_WAVED : SimpleTextAttributes.STYLE_PLAIN);
    }
    else {
      if (object instanceof PsiDirectory) {
        VirtualFile vDir = ((PsiDirectory)object).getVirtualFile();
        if (vDir.getParent() == null || ProjectRootsUtil.isModuleContentRoot(vDir, myProject)) {
          return SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
        }
      }

      if (wolfHasProblemFilesBeneath((PsiElement)object)) {
        return WOLFED;
      }
    }
  }
  else if (object instanceof Module) {
    if (WolfTheProblemSolver.getInstance(myProject).hasProblemFilesBeneath((Module)object)) {
      return WOLFED;
    }

  }
  else if (object instanceof Project) {
    final Project project = (Project)object;
    final Module[] modules = ApplicationManager.getApplication().runReadAction(new Computable<Module[]>() {
      @Override
      public Module[] compute() {
        return ModuleManager.getInstance(project).getModules();
      }
    });
    for (Module module : modules) {
      if (WolfTheProblemSolver.getInstance(project).hasProblemFilesBeneath(module)) {
        return WOLFED;
      }
    }
  }
  return SimpleTextAttributes.REGULAR_ATTRIBUTES;
}