コード例 #1
0
 private static TextAttributes mergeAttributes(TextAttributes primary, TextAttributes secondary) {
   if (primary == null) return secondary;
   if (secondary == null) return primary;
   return new TextAttributes(
       primary.getForegroundColor() == null
           ? secondary.getForegroundColor()
           : primary.getForegroundColor(),
       primary.getBackgroundColor() == null
           ? secondary.getBackgroundColor()
           : primary.getBackgroundColor(),
       primary.getEffectColor() == null ? secondary.getEffectColor() : primary.getEffectColor(),
       primary.getEffectType() == null ? secondary.getEffectType() : primary.getEffectType(),
       primary.getFontType() == Font.PLAIN ? secondary.getFontType() : primary.getFontType());
 }
コード例 #2
0
  public static void printToConsole(
      @NotNull final LanguageConsoleImpl console,
      @NotNull final String string,
      @NotNull final ConsoleViewContentType mainType,
      @Nullable ConsoleViewContentType additionalType) {
    final TextAttributes mainAttributes = mainType.getAttributes();
    final TextAttributes attributes;
    if (additionalType == null) {
      attributes = mainAttributes;
    } else {
      attributes = additionalType.getAttributes().clone();
      attributes.setBackgroundColor(mainAttributes.getBackgroundColor());
    }

    Application application = ApplicationManager.getApplication();
    if (application.isDispatchThread()) {
      console.printToHistory(string, attributes);
    } else {
      application.invokeLater(
          new Runnable() {
            public void run() {
              console.printToHistory(string, attributes);
            }
          },
          ModalityState.stateForComponent(console.getComponent()));
    }
  }
コード例 #3
0
 private void paintBackground(
     Graphics2D g, TextAttributes attributes, float x, int y, float width) {
   if (attributes == null) return;
   paintBackground(g, attributes.getBackgroundColor(), x, y, width);
 }
コード例 #4
0
 @Nullable
 private static Color getScrollMarkColor(@NotNull TextAttributes attributes) {
   if (attributes.getErrorStripeColor() != null) return attributes.getErrorStripeColor();
   if (attributes.getBackgroundColor() != null) return attributes.getBackgroundColor().darker();
   return null;
 }