Java 类com.intellij.ui.ColoredTreeCellRenderer 实例源码

项目:intellij-ce-playground    文件:JavaMethodNode.java   
@Override
protected void customizeRendererText(ColoredTreeCellRenderer renderer) {
  final StringBuilder buffer = new StringBuilder(128);
  final PsiClass containingClass = myMethod.getContainingClass();
  if (containingClass != null) {
    buffer.append(ClassPresentationUtil.getNameForClass(containingClass, false));
    buffer.append('.');
  }
  final String methodText = PsiFormatUtil.formatMethod(
    myMethod,
    PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS,
    PsiFormatUtil.SHOW_TYPE
  );
  buffer.append(methodText);

  final SimpleTextAttributes attributes = isEnabled() ?
                                          new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getTreeForeground()) :
                                          SimpleTextAttributes.EXCLUDED_ATTRIBUTES;
  renderer.append(buffer.toString(), attributes);

  if (containingClass != null) {
    final String packageName = getPackageName(containingClass);
    renderer.append("  (" + packageName + ")", new SimpleTextAttributes(SimpleTextAttributes.STYLE_ITALIC, JBColor.GRAY));
  }
}
项目:intellij-ce-playground    文件:BreakpointsTreeCellRenderer.java   
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));
    if (group instanceof XBreakpointCustomGroup && ((XBreakpointCustomGroup)group).isDefault()) {
      renderer.append(group.getName(), SIMPLE_CELL_ATTRIBUTES_BOLD);
    }
    else {
      renderer.append(group.getName(), SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES);
    }
  }
}
项目:intellij-ce-playground    文件:BreakpointsFavoriteListProvider.java   
@Override
public void customizeRenderer(ColoredTreeCellRenderer renderer,
                              JTree tree,
                              @NotNull 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));
  }
}
项目:intellij-ce-playground    文件:BookmarksFavoriteListProvider.java   
@Override
public void customizeRenderer(ColoredTreeCellRenderer renderer,
                              JTree tree,
                              @NotNull Object value,
                              boolean selected,
                              boolean expanded,
                              boolean leaf,
                              int row,
                              boolean hasFocus) {
  renderer.clear();
  renderer.setIcon(Bookmark.DEFAULT_ICON);
  if (value instanceof Bookmark) {
    Bookmark bookmark = (Bookmark)value;
    BookmarkItem.setupRenderer(renderer, myProject, bookmark, selected);
    if (renderer.getIcon() != null) {
      renderer.setIcon(LayeredIcon.createHorizontalIcon(bookmark.getIcon(), renderer.getIcon()));
    }
    else {
      renderer.setIcon(bookmark.getIcon());
    }
  }
  else {
    renderer.append(getListName(myProject));
  }
}
项目:intellij-ce-playground    文件:UpdaterTreeNode.java   
public Renderer() {
  super(new BorderLayout());
  myCheckbox = new ThreeStateCheckBox();
  myTextRenderer = new ColoredTreeCellRenderer() {
    @Override
    public void customizeCellRenderer(@NotNull JTree tree,
                                      Object value,
                                      boolean selected,
                                      boolean expanded,
                                      boolean leaf,
                                      int row,
                                      boolean hasFocus) {
    }
  };
  myTextRenderer.setOpaque(true);
  add(myCheckbox, BorderLayout.WEST);
  add(myTextRenderer, BorderLayout.CENTER);
}
项目:intellij-ce-playground    文件:ColumnTreeBuilder.java   
@Override
public Component getTreeCellRendererComponent(JTree tree,
                                              Object value,
                                              boolean selected,
                                              boolean expanded,
                                              boolean leaf,
                                              int row,
                                              boolean hasFocus) {
  setFont(tree.getFont());
  for (int i = 0; i < getComponentCount(); i++) {
    Component component = getComponent(i);
    if (component instanceof ColoredTreeCellRenderer) {
      ((ColoredTreeCellRenderer)component).getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
    }
  }
  return this;
}
项目:intellij-ce-playground    文件:CoverageProjectViewClassNodeDecorator.java   
public void decorate(PackageDependenciesNode node, ColoredTreeCellRenderer cellRenderer) {
  final PsiElement element = node.getPsiElement();
  if (element == null || !element.isValid()) {
    return;
  }

  final CoverageDataManager dataManager = getCoverageDataManager();
  final CoverageSuitesBundle currentSuite = dataManager.getCurrentSuitesBundle();
  final Project project = element.getProject();

  final JavaCoverageAnnotator javaCovAnnotator = getCovAnnotator(currentSuite, project);
  // This decorator is applicable only to JavaCoverageAnnotator
  if (javaCovAnnotator == null) {
    return;
  }

  if (element instanceof PsiClass) {
    final String qName = ((PsiClass)element).getQualifiedName();
    if (qName != null) {
      appendCoverageInfo(cellRenderer, javaCovAnnotator.getClassCoverageInformationString(qName, dataManager));
    }
  }
}
项目:intellij-ce-playground    文件:CoverageProjectViewDirectoryNodeDecorator.java   
public void decorate(PackageDependenciesNode node, ColoredTreeCellRenderer cellRenderer) {
  final PsiElement element = node.getPsiElement();
  if (element == null || !element.isValid()) {
    return;
  }

  final CoverageDataManager manager = getCoverageDataManager();
  final CoverageSuitesBundle currentSuite = manager.getCurrentSuitesBundle();
  final CoverageAnnotator coverageAnnotator = currentSuite != null ? currentSuite.getAnnotator(element.getProject()) : null;
  if (coverageAnnotator == null) {
    // N/A
    return;
  }

  String informationString = null;
  if (element instanceof PsiDirectory) {
    informationString = coverageAnnotator.getDirCoverageInformationString((PsiDirectory) element, currentSuite, manager);
  }
  else if (element instanceof PsiFile) {
    informationString = coverageAnnotator.getFileCoverageInformationString((PsiFile)element, currentSuite, manager);
  }
  if (informationString != null) {
    appendCoverageInfo(cellRenderer, informationString);
  }
}
项目:intellij    文件:BlazeCoverageProjectViewClassDecorator.java   
@Override
public void decorate(PackageDependenciesNode node, ColoredTreeCellRenderer cellRenderer) {
  PsiFile file = getPsiFileForJavaClass(node.getPsiElement());
  if (file == null) {
    return;
  }
  CoverageDataManager manager = getCoverageDataManager();
  CoverageSuitesBundle currentSuite = manager.getCurrentSuitesBundle();
  Project project = file.getProject();
  BlazeCoverageAnnotator annotator = getAnnotator(project, currentSuite);
  if (annotator == null) {
    return;
  }
  String string = annotator.getFileCoverageInformationString(file, currentSuite, manager);
  if (string != null) {
    appendCoverageInfo(cellRenderer, string);
  }
}
项目:tools-idea    文件:JavaMethodNode.java   
@Override
protected void customizeRendererText(ColoredTreeCellRenderer renderer) {
  final StringBuffer buffer = new StringBuffer(128);
  final PsiClass containingClass = myMethod.getContainingClass();
  if (containingClass != null) {
    buffer.append(ClassPresentationUtil.getNameForClass(containingClass, false));
    buffer.append('.');
  }
  final String methodText = PsiFormatUtil.formatMethod(
    myMethod,
    PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS,
    PsiFormatUtil.SHOW_TYPE
  );
  buffer.append(methodText);

  final SimpleTextAttributes attributes = isEnabled() ?
                                          new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getTreeForeground()) :
                                          SimpleTextAttributes.EXCLUDED_ATTRIBUTES;
  renderer.append(buffer.toString(), attributes);

  if (containingClass != null) {
    final String packageName = getPackageName(containingClass);
    renderer.append("  (" + packageName + ")", new SimpleTextAttributes(SimpleTextAttributes.STYLE_ITALIC, JBColor.GRAY));
  }
}
项目:tools-idea    文件:BreakpointsTreeCellRenderer.java   
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);
  }
}
项目:tools-idea    文件:BreakpointsFavoriteListProvider.java   
@Override
public void customizeRenderer(ColoredTreeCellRenderer renderer,
                              JTree tree,
                              @NotNull 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));
  }
}
项目:tools-idea    文件:BookmarksFavoriteListProvider.java   
@Override
public void customizeRenderer(ColoredTreeCellRenderer renderer,
                              JTree tree,
                              @NotNull Object value,
                              boolean selected,
                              boolean expanded,
                              boolean leaf,
                              int row,
                              boolean hasFocus) {
  renderer.clear();
  renderer.setIcon(Bookmark.DEFAULT_ICON);
  if (value instanceof Bookmark) {
    Bookmark bookmark = (Bookmark)value;
    BookmarkItem.setupRenderer(renderer, myProject, bookmark, selected);
    if (renderer.getIcon() != null) {
      renderer.setIcon(LayeredIcon.createHorizontalIcon(bookmark.getIcon(), renderer.getIcon()));
    }
    else {
      renderer.setIcon(bookmark.getIcon());
    }
  }
  else {
    renderer.append(getListName(myProject));
  }
}
项目:consulo    文件:CoverageProjectViewDirectoryNodeDecorator.java   
public void decorate(PackageDependenciesNode node, ColoredTreeCellRenderer cellRenderer) {
  final PsiElement element = node.getPsiElement();
  if (element == null || !element.isValid()) {
    return;
  }

  final CoverageDataManager manager = getCoverageDataManager();
  final CoverageSuitesBundle currentSuite = manager.getCurrentSuitesBundle();
  final CoverageAnnotator coverageAnnotator = currentSuite != null ? currentSuite.getAnnotator(element.getProject()) : null;
  if (coverageAnnotator == null) {
    // N/A
    return;
  }

  if (element instanceof PsiDirectory) {
    final String informationString = coverageAnnotator.getDirCoverageInformationString((PsiDirectory) element, currentSuite, manager);
    if (informationString != null) {
      appendCoverageInfo(cellRenderer, informationString);
    }
  }
}
项目:consulo    文件:BreakpointsTreeCellRenderer.java   
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);
  }
}
项目:consulo    文件:BreakpointsFavoriteListProvider.java   
@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));
  }
}
项目:consulo    文件:ExtensionTreeCellRenderer.java   
@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() : IconLoader.getTransparentIcon(providerEP.getIcon()));
    if (enabled) {
      textRenderer.append(providerEP.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    }
    else {
      textRenderer.append(providerEP.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
    }
  }
}
项目:consulo-java    文件:CoverageProjectViewClassNodeDecorator.java   
public void decorate(PackageDependenciesNode node, ColoredTreeCellRenderer cellRenderer) {
  final PsiElement element = node.getPsiElement();
  if (element == null || !element.isValid()) {
    return;
  }

  final CoverageDataManager dataManager = getCoverageDataManager();
  final CoverageSuitesBundle currentSuite = dataManager.getCurrentSuitesBundle();
  final Project project = element.getProject();

  final JavaCoverageAnnotator javaCovAnnotator = getCovAnnotator(currentSuite, project);
  // This decorator is applicable only to JavaCoverageAnnotator
  if (javaCovAnnotator == null) {
    return;
  }

  if (element instanceof PsiClass) {
    final String qName = ((PsiClass)element).getQualifiedName();
    if (qName != null) {
      appendCoverageInfo(cellRenderer, javaCovAnnotator.getClassCoverageInformationString(qName, dataManager));
    }
  }
}
项目:consulo-java    文件:JavaMethodNode.java   
@Override
protected void customizeRendererText(ColoredTreeCellRenderer renderer) {
  final StringBuffer buffer = new StringBuffer(128);
  final PsiClass containingClass = myMethod.getContainingClass();
  if (containingClass != null) {
    buffer.append(ClassPresentationUtil.getNameForClass(containingClass, false));
    buffer.append('.');
  }
  final String methodText = PsiFormatUtil.formatMethod(
    myMethod,
    PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS,
    PsiFormatUtil.SHOW_TYPE
  );
  buffer.append(methodText);

  final SimpleTextAttributes attributes = isEnabled() ?
                                          new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getTreeForeground()) :
                                          SimpleTextAttributes.EXCLUDED_ATTRIBUTES;
  renderer.append(buffer.toString(), attributes);

  if (containingClass != null) {
    final String packageName = getPackageName(containingClass);
    renderer.append("  (" + packageName + ")", new SimpleTextAttributes(SimpleTextAttributes.STYLE_ITALIC, JBColor.GRAY));
  }
}
项目:intellij-ce-playground    文件:SingleRepositoryNode.java   
@Override
public void render(@NotNull ColoredTreeCellRenderer renderer) {
  if (myLoading.get()) {
    renderer.setIcon(myRepositoryPanel.getLoadingIcon());
    renderer.setIconOnTheRight(true);
  }
  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);
}
项目:intellij-ce-playground    文件:TextWithLinkNode.java   
@Override
public void render(@NotNull 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);
}
项目:intellij-ce-playground    文件:CommitNode.java   
@Override
public void render(@NotNull 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()));
}
项目:intellij-ce-playground    文件:RepositoryNode.java   
public void render(@NotNull ColoredTreeCellRenderer renderer, @Nullable String syncEditingText) {
  int repoFixedWidth = 120;
  int borderHOffset = myRepositoryPanel.getHBorderOffset(renderer);
  if (myLoading.get()) {
    renderer.setIcon(myLoadingIcon);
    renderer.setIconOnTheRight(false);
    int checkBoxWidth = myRepositoryPanel.getCheckBoxWidth();
    repoFixedWidth += checkBoxWidth;
    if (myCheckBoxHGap > 0) {
      renderer.append("");
      renderer.appendTextPadding(checkBoxWidth + renderer.getIconTextGap() + borderHOffset);
    }
  }
  else {
    if (myCheckBoxHGap <= 0) {
      renderer.append("");
      renderer.appendTextPadding(myRepositoryPanel.calculateRendererShiftH(renderer));
    }
  }
  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);

  int maxSize = Math.max(myRepositoryPanel.getCheckBoxHeight(), myLoadingIcon.getIconHeight());
  int rendererHeight = renderer.getPreferredSize().height;
  if (maxSize > rendererHeight) {
    if (myCheckBoxVGap > 0 && isLoading() || myCheckBoxVGap < 0 && !isLoading()) {
      int vShift = maxSize - rendererHeight;
      renderer.setBorder(new EmptyBorder((vShift + 1) / 2, 0, (vShift) / 2, 0));
    }
  }
}
项目:intellij-ce-playground    文件:VcsLinkedTextComponent.java   
public void render(@NotNull 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);
}
项目:intellij-ce-playground    文件:FavoritesListProvider.java   
void customizeRenderer(ColoredTreeCellRenderer renderer,
JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus);
项目:intellij-ce-playground    文件:AbstractFavoritesListProvider.java   
@Override
public void customizeRenderer(ColoredTreeCellRenderer renderer,
                              JTree tree,
                              @NotNull Object value,
                              boolean selected,
                              boolean expanded,
                              boolean leaf,
                              int row,
                              boolean hasFocus) {
}
项目:intellij-ce-playground    文件:MethodNodeBase.java   
public void customizeRenderer(ColoredTreeCellRenderer renderer) {
  if (myMethod == null) return;
  int flags = Iconable.ICON_FLAG_VISIBILITY | Iconable.ICON_FLAG_READ_STATUS;
  renderer.setIcon(myMethod.getIcon(flags));

  customizeRendererText(renderer);
}
项目:intellij-ce-playground    文件:DetectedFrameworkNode.java   
@Override
public void renderNode(ColoredTreeCellRenderer renderer) {
  renderer.setIcon(myDescription.getDetector().getFrameworkType().getIcon());
  final Collection<? extends VirtualFile> files = myDescription.getRelatedFiles();
  final VirtualFile firstFile = ContainerUtil.getFirstItem(files);
  LOG.assertTrue(firstFile != null);
  if (files.size() == 1) {
    renderer.append(firstFile.getName());
    appendDirectoryPath(renderer, firstFile.getParent());
  }
  else {
    String commonName = firstFile.getName();
    VirtualFile commonParent = firstFile.getParent();
    for (VirtualFile file : files) {
      if (commonName != null && !commonName.equals(file.getName())) {
        commonName = null;
      }
      if (commonParent != null && !commonParent.equals(file.getParent())) {
        commonParent = null;
      }
    }
    renderer.append(files.size() + " " + (commonName != null ? commonName : firstFile.getFileType().getDefaultExtension()) + " files");
    if (commonParent != null) {
      appendDirectoryPath(renderer, commonParent);
    }
  }
}
项目:intellij-ce-playground    文件:VariantCheckboxTreeCellRenderer.java   
protected void appendModule(@NotNull Module module, @Nullable String variant) {
  ColoredTreeCellRenderer textRenderer = getTextRenderer();
  textRenderer.append(module.getName());
  textRenderer.setIcon(GradleUtil.getModuleIcon(module));
  if (StringUtil.isNotEmpty(variant)) {
    textRenderer.append(" ", REGULAR_ATTRIBUTES);
    textRenderer.append("(" + variant + ")", GRAY_ATTRIBUTES);
  }
}
项目:intellij-ce-playground    文件:TaskManagerImpl.java   
public void decorateChangeList(@NotNull LocalChangeList changeList,
                               @NotNull ColoredTreeCellRenderer cellRenderer,
                               boolean selected,
                               boolean expanded,
                               boolean hasFocus) {
  LocalTask task = getAssociatedTask(changeList);
  if (task != null && task.isIssue()) {
    cellRenderer.setIcon(task.getIcon());
  }
}
项目:intellij-ce-playground    文件:GitPushTargetPanel.java   
@Override
public void render(@NotNull ColoredTreeCellRenderer renderer, boolean isSelected, boolean isActive, @Nullable String forceRenderedText) {

  SimpleTextAttributes targetTextAttributes = PushLogTreeUtil.addTransparencyIfNeeded(SimpleTextAttributes.REGULAR_ATTRIBUTES, isActive);
  if (myError != null) {
    renderer.append(myError, PushLogTreeUtil.addTransparencyIfNeeded(SimpleTextAttributes.ERROR_ATTRIBUTES, isActive));
  }
  else {
    String currentRemote = myRemoteRenderer.getText();
    List<String> remotes = getRemotes();
    if (remotes.isEmpty() || remotes.size() > 1) {
      myRemoteRenderer.setSelected(isSelected);
      myRemoteRenderer.setTransparent(!remotes.isEmpty() && !isActive);
      myRemoteRenderer.render(renderer);
    }
    else {
      renderer.append(currentRemote, targetTextAttributes);
    }
    if (!remotes.isEmpty()) {
      renderer.append(SEPARATOR, targetTextAttributes);
      if (forceRenderedText != null) {
        // update only appearance; do not update model in rendering!!!!
        renderer.append(forceRenderedText);
        return;
      }
      GitPushTarget target = getValue();
      if (target != null && target.isNewBranchCreated()) {
        renderer.append("+", PushLogTreeUtil.addTransparencyIfNeeded(SimpleTextAttributes.SYNTHETIC_ATTRIBUTES, isActive), this);
      }
      myTargetRenderer.setSelected(isSelected);
      myTargetRenderer.setTransparent(!isActive);
      myTargetRenderer.render(renderer);
    }
  }
}
项目:intellij-ce-playground    文件:HgPushTargetPanel.java   
@Override
public void render(@NotNull ColoredTreeCellRenderer renderer, boolean isSelected, boolean isActive, @Nullable String forceRenderedText) {
  if (forceRenderedText != null) {
    myDestTargetPanel.setText(forceRenderedText);
    renderer.append(forceRenderedText);
    return;
  }
  String targetText = myDestTargetPanel.getText();
  if (StringUtil.isEmptyOrSpaces(targetText)) {
    renderer.append(ENTER_REMOTE, SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES, this);
  }
  myTargetRenderedComponent.setSelected(isSelected);
  myTargetRenderedComponent.setTransparent(!isActive);
  myTargetRenderedComponent.render(renderer);
}
项目:intellij-ce-playground    文件:ComponentTree.java   
private void installCellRenderer() {
  setCellRenderer(new ColoredTreeCellRenderer() {
    @Override
    public void customizeCellRenderer(JTree tree,
                                      Object value,
                                      boolean selected,
                                      boolean expanded,
                                      boolean leaf,
                                      int row,
                                      boolean hasFocus) {
      try {
        RadComponent component = extractComponent(value);

        if (component != null) {
          myDesigner.getTreeDecorator().decorate(component, this, getAttributeWrapper(component), true);

          if (myMarkComponent == component) {
            if (myMarkFeedback == FeedbackTreeLayer.INSERT_SELECTION) {
              setBorder(BorderFactory.createLineBorder(Color.RED, 1));
            }
            else {
              setBorder(new InsertBorder(myMarkFeedback));
            }
          }
          else {
            setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
          }
        }
      }
      catch (RuntimeException e) {
        if (myDesigner == null) {
          throw e;
        }
        myDesigner.showError("Tree paint operation", e);
      }
    }
  });
}
项目:tools-idea    文件:FavoritesListProvider.java   
void customizeRenderer(ColoredTreeCellRenderer renderer,
JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus);
项目:tools-idea    文件:AbstractFavoritesListProvider.java   
@Override
public void customizeRenderer(ColoredTreeCellRenderer renderer,
                              JTree tree,
                              @NotNull Object value,
                              boolean selected,
                              boolean expanded,
                              boolean leaf,
                              int row,
                              boolean hasFocus) {
}
项目:tools-idea    文件:MethodNodeBase.java   
public void customizeRenderer(ColoredTreeCellRenderer renderer) {
  if (myMethod == null) return;
  int flags = Iconable.ICON_FLAG_VISIBILITY | Iconable.ICON_FLAG_READ_STATUS;
  renderer.setIcon(myMethod.getIcon(flags));

  customizeRendererText(renderer);
}
项目:tools-idea    文件:DetectedFrameworkNode.java   
@Override
public void renderNode(ColoredTreeCellRenderer renderer) {
  renderer.setIcon(myDescription.getDetector().getFrameworkType().getIcon());
  final Collection<? extends VirtualFile> files = myDescription.getRelatedFiles();
  final VirtualFile firstFile = ContainerUtil.getFirstItem(files);
  LOG.assertTrue(firstFile != null);
  if (files.size() == 1) {
    renderer.append(firstFile.getName());
    appendDirectoryPath(renderer, firstFile.getParent());
  }
  else {
    String commonName = firstFile.getName();
    VirtualFile commonParent = firstFile.getParent();
    for (VirtualFile file : files) {
      if (commonName != null && !commonName.equals(file.getName())) {
        commonName = null;
      }
      if (commonParent != null && !commonParent.equals(file.getParent())) {
        commonParent = null;
      }
    }
    renderer.append(files.size() + " " + (commonName != null ? commonName : firstFile.getFileType().getDefaultExtension()) + " files");
    if (commonParent != null) {
      appendDirectoryPath(renderer, commonParent);
    }
  }
}
项目:tools-idea    文件:TaskManagerImpl.java   
public void decorateChangeList(LocalChangeList changeList, ColoredTreeCellRenderer cellRenderer, boolean selected,
                               boolean expanded, boolean hasFocus) {
  LocalTask task = getAssociatedTask(changeList);
  if (task != null && task.isIssue()) {
    cellRenderer.setIcon(task.getIcon());
  }
}
项目:tools-idea    文件:ComponentTree.java   
private void installCellRenderer() {
  setCellRenderer(new ColoredTreeCellRenderer() {
    @Override
    public void customizeCellRenderer(JTree tree,
                                      Object value,
                                      boolean selected,
                                      boolean expanded,
                                      boolean leaf,
                                      int row,
                                      boolean hasFocus) {
      try {
        RadComponent component = extractComponent(value);

        if (component != null) {
          myDesigner.getTreeDecorator().decorate(component, this, getAttributeWrapper(component), true);

          if (myMarkComponent == component) {
            if (myMarkFeedback == FeedbackTreeLayer.INSERT_SELECTION) {
              setBorder(BorderFactory.createLineBorder(Color.RED, 1));
            }
            else {
              setBorder(new InsertBorder(myMarkFeedback));
            }
          }
          else {
            setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
          }
        }
      }
      catch (RuntimeException e) {
        if (myDesigner == null) {
          throw e;
        }
        myDesigner.showError("Tree paint operation", e);
      }
    }
  });
}
项目:cordovastudio    文件:ComponentTree.java   
private void installCellRenderer() {
  setCellRenderer(new ColoredTreeCellRenderer() {
    @Override
    public void customizeCellRenderer(JTree tree,
                                      Object value,
                                      boolean selected,
                                      boolean expanded,
                                      boolean leaf,
                                      int row,
                                      boolean hasFocus) {
      try {
        RadComponent component = extractComponent(value);

        if (component != null) {
          myDesigner.getTreeDecorator().decorate(component, this, getAttributeWrapper(component), true);

          if (myMarkComponent == component) {
            if (myMarkFeedback == FeedbackTreeLayer.INSERT_SELECTION) {
              setBorder(BorderFactory.createLineBorder(Color.RED, 1));
            }
            else {
              setBorder(new InsertBorder(myMarkFeedback));
            }
          }
          else {
            setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
          }
        }
      }
      catch (RuntimeException e) {
        if (myDesigner == null) {
          throw e;
        }
        myDesigner.showError("Tree paint operation", e);
      }
    }
  });
}