Java Code Examples for com.intellij.ui.ColoredTreeCellRenderer#append()

The following examples show how to use com.intellij.ui.ColoredTreeCellRenderer#append() . 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: ExtensionTreeCellRenderer.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void customizeRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  if (value instanceof ExtensionCheckedTreeNode) {
    ExtensionCheckedTreeNode extensionCheckedTreeNode = (ExtensionCheckedTreeNode)value;

    final ModuleExtensionProviderEP providerEP = extensionCheckedTreeNode.getProviderEP();
    if (providerEP == null) {
      return;
    }

    ColoredTreeCellRenderer textRenderer = getTextRenderer();

    boolean enabled = extensionCheckedTreeNode.isEnabled();
    textRenderer.setIcon(enabled ? providerEP.getIcon() : ImageEffects.transparent(providerEP.getIcon()));
    if (enabled) {
      textRenderer.append(providerEP.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    }
    else {
      textRenderer.append(providerEP.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
    }
  }
}
 
Example 2
Source File: BreakpointsFavoriteListProvider.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void customizeRenderer(ColoredTreeCellRenderer renderer,
                              JTree tree,
                              @Nonnull Object value,
                              boolean selected,
                              boolean expanded,
                              boolean leaf,
                              int row,
                              boolean hasFocus) {
  renderer.clear();
  renderer.setIcon(AllIcons.Debugger.Db_set_breakpoint);
  if (value instanceof BreakpointItem) {
    BreakpointItem breakpointItem = (BreakpointItem)value;
    breakpointItem.setupGenericRenderer(renderer, true);
  }
  else if (value instanceof XBreakpointGroup) {
    renderer.append(((XBreakpointGroup)value).getName());
    renderer.setIcon(((XBreakpointGroup)value).getIcon(expanded));
  }
  else if (value instanceof XBreakpointGroupingRule) {
    renderer.append(((XBreakpointGroupingRule)value).getPresentableName());
  }
  else {
    renderer.append(String.valueOf(value));
  }
}
 
Example 3
Source File: BreakpointsTreeCellRenderer.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void customizeRenderer(Project project,
                                      Object value,
                                      boolean selected,
                                      boolean expanded,
                                      ColoredTreeCellRenderer renderer) {
  if (value instanceof BreakpointItemNode) {
    BreakpointItemNode node = (BreakpointItemNode)value;
    BreakpointItem breakpoint = node.getBreakpointItem();
    breakpoint.setupRenderer(renderer, project, selected);
  }
  else if (value instanceof BreakpointsGroupNode) {
    XBreakpointGroup group = ((BreakpointsGroupNode)value).getGroup();
    renderer.setIcon(group.getIcon(expanded));
    renderer.append(group.getName(), SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES);
  }
}
 
Example 4
Source File: TextWithLinkNode.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void render(@Nonnull ColoredTreeCellRenderer renderer) {
  renderer.append("   ");
  myLinkedText.setSelected(renderer.getTree().isPathSelected(TreeUtil.getPathFromRoot(this)));
  TreeNode parent = getParent();
  if (parent instanceof RepositoryNode) {
    myLinkedText.setTransparent(!((RepositoryNode)parent).isChecked());
  }
  myLinkedText.render(renderer);
}
 
Example 5
Source File: BookmarksFavoriteListProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void customizeRenderer(ColoredTreeCellRenderer renderer,
                              JTree tree,
                              @Nonnull Object value,
                              boolean selected,
                              boolean expanded,
                              boolean leaf,
                              int row,
                              boolean hasFocus) {
  renderer.clear();
  renderer.setIcon(Bookmark.getDefaultIcon());
  if (value instanceof Bookmark) {
    Bookmark bookmark = (Bookmark)value;
    BookmarkItem.setupRenderer(renderer, myProject, bookmark, selected);
    if (renderer.getIcon() != null) {
      RowIcon icon = new RowIcon(3, RowIcon.Alignment.CENTER);
      icon.setIcon(TargetAWT.to(bookmark.getIcon()), 0);
      icon.setIcon(JBUI.scale(EmptyIcon.create(1)), 1);
      icon.setIcon(renderer.getIcon(), 2);
      renderer.setIcon(icon);
    }
    else {
      renderer.setIcon(bookmark.getIcon());
    }
  }
  else {
    renderer.append(getListName(myProject));
  }
}
 
Example 6
Source File: VcsLinkedTextComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void render(@Nonnull ColoredTreeCellRenderer renderer) {
  boolean isActive = mySelected || myUnderlined;
  SimpleTextAttributes linkTextAttributes = isActive ? SimpleTextAttributes.LINK_ATTRIBUTES : SimpleTextAttributes.SYNTHETIC_ATTRIBUTES;
  isActive = isActive || !myTransparent;
  SimpleTextAttributes wrappedTextAttributes = PushLogTreeUtil
    .addTransparencyIfNeeded(SimpleTextAttributes.REGULAR_ATTRIBUTES, isActive);
  if (!StringUtil.isEmptyOrSpaces(myTextBefore)) {
    renderer.append(myTextBefore, wrappedTextAttributes);
    renderer.append(" ");
  }
  if (!StringUtil.isEmptyOrSpaces(myHandledLink)) {
    renderer.append(myHandledLink, PushLogTreeUtil.addTransparencyIfNeeded(linkTextAttributes, isActive), this);
  }
  renderer.append(myTextAfter, wrappedTextAttributes);
}
 
Example 7
Source File: RepositoryNode.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void render(@Nonnull ColoredTreeCellRenderer renderer, @javax.annotation.Nullable String syncEditingText) {
  int repoFixedWidth = 120;
  SimpleTextAttributes repositoryDetailsTextAttributes = PushLogTreeUtil
          .addTransparencyIfNeeded(SimpleTextAttributes.REGULAR_ATTRIBUTES, isChecked());

  renderer.append(getRepoName(renderer, repoFixedWidth), repositoryDetailsTextAttributes);
  renderer.appendTextPadding(repoFixedWidth);
  renderer.append(myRepositoryPanel.getSourceName(), repositoryDetailsTextAttributes);
  renderer.append(myRepositoryPanel.getArrow(), repositoryDetailsTextAttributes);
  PushTargetPanel pushTargetPanel = myRepositoryPanel.getTargetPanel();
  pushTargetPanel.render(renderer, renderer.getTree().isPathSelected(TreeUtil.getPathFromRoot(this)), isChecked(), syncEditingText);
}
 
Example 8
Source File: CommitNode.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void render(@Nonnull ColoredTreeCellRenderer renderer) {
  renderer.append("   ");
  TreeNode parent = getParent();
  new IssueLinkRenderer(myProject, renderer).appendTextWithLinks(getUserObject().getSubject(), PushLogTreeUtil
    .addTransparencyIfNeeded(SimpleTextAttributes.REGULAR_ATTRIBUTES,
                             !(parent instanceof RepositoryNode) || ((RepositoryNode)parent).isChecked()));
}
 
Example 9
Source File: SingleRepositoryNode.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void render(@Nonnull ColoredTreeCellRenderer renderer) {
  renderer.append(" ");
  renderer.append(myRepositoryPanel.getSourceName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
  renderer.append(myRepositoryPanel.getArrow(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
  PushTargetPanel pushTargetPanel = myRepositoryPanel.getTargetPanel();
  pushTargetPanel.render(renderer, renderer.getTree().isPathSelected(TreeUtil.getPathFromRoot(this)), true, null);
}
 
Example 10
Source File: RedisKeyValueDescriptor.java    From nosql4idea with Apache License 2.0 5 votes vote down vote up
public void renderNode(ColoredTreeCellRenderer cellRenderer) {
    cellRenderer.setIcon(this.icon);
    if (this.keyType != null) {
        cellRenderer.append(this.keyType.name(), StyleAttributesProvider.getIndexAttribute());
        cellRenderer.append(" ");
    }
    cellRenderer.append(getFormattedKey(), StyleAttributesProvider.getKeyValueAttribute());
}
 
Example 11
Source File: MongoKeyValueDescriptor.java    From nosql4idea with Apache License 2.0 4 votes vote down vote up
public void renderNode(ColoredTreeCellRenderer cellRenderer) {
    cellRenderer.append(getFormattedKey(), StyleAttributesProvider.getKeyValueAttribute());
}
 
Example 12
Source File: AbstractCoverageProvejctViewNodeDecorator.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected static void appendCoverageInfo(ColoredTreeCellRenderer cellRenderer, String coverageInfo) {
  if (coverageInfo != null) {
    cellRenderer.append(" (" + coverageInfo + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
}
 
Example 13
Source File: CouchbaseKeyValueDescriptor.java    From nosql4idea with Apache License 2.0 4 votes vote down vote up
public void renderNode(ColoredTreeCellRenderer cellRenderer) {
    cellRenderer.append(getFormattedKey(), StyleAttributesProvider.getKeyValueAttribute());
}
 
Example 14
Source File: CouchbaseValueDescriptor.java    From nosql4idea with Apache License 2.0 4 votes vote down vote up
public void renderNode(ColoredTreeCellRenderer cellRenderer) {
    cellRenderer.append(getFormattedKey(), StyleAttributesProvider.getIndexAttribute());
}
 
Example 15
Source File: FragmentedKeyNodeDescriptor.java    From nosql4idea with Apache License 2.0 4 votes vote down vote up
@Override
public void renderNode(ColoredTreeCellRenderer cellRenderer) {
    cellRenderer.append(keyFragment, keyAttribute);
    cellRenderer.setIcon(AllIcons.Nodes.Advice);
}
 
Example 16
Source File: ChangesBrowserNode.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected void appendCount(@Nonnull ColoredTreeCellRenderer renderer) {
  renderer.append(getCountText(), SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
 
Example 17
Source File: RedisValueDescriptor.java    From nosql4idea with Apache License 2.0 4 votes vote down vote up
@Override
public void renderNode(ColoredTreeCellRenderer cellRenderer) {
    cellRenderer.append(getFormattedKey(), StyleAttributesProvider.getIndexAttribute());
}
 
Example 18
Source File: MongoValueDescriptor.java    From nosql4idea with Apache License 2.0 4 votes vote down vote up
public void renderNode(ColoredTreeCellRenderer cellRenderer) {
    cellRenderer.append(getFormattedKey(), StyleAttributesProvider.getIndexAttribute());
}