当前位置: 首页>>代码示例>>Java>>正文


Java ColoredTreeCellRenderer类代码示例

本文整理汇总了Java中com.intellij.ui.ColoredTreeCellRenderer的典型用法代码示例。如果您正苦于以下问题:Java ColoredTreeCellRenderer类的具体用法?Java ColoredTreeCellRenderer怎么用?Java ColoredTreeCellRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ColoredTreeCellRenderer类属于com.intellij.ui包,在下文中一共展示了ColoredTreeCellRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: customizeRendererText

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
@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));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JavaMethodNode.java

示例2: customizeRenderer

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
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);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:BreakpointsTreeCellRenderer.java

示例3: customizeRenderer

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
@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));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:BreakpointsFavoriteListProvider.java

示例4: customizeRenderer

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
@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));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:BookmarksFavoriteListProvider.java

示例5: Renderer

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:UpdaterTreeNode.java

示例6: getTreeCellRendererComponent

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
@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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ColumnTreeBuilder.java

示例7: decorate

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
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));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CoverageProjectViewClassNodeDecorator.java

示例8: decorate

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:CoverageProjectViewDirectoryNodeDecorator.java

示例9: decorate

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:19,代码来源:BlazeCoverageProjectViewClassDecorator.java

示例10: customizeRendererText

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
@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));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:JavaMethodNode.java

示例11: customizeRenderer

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
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);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:BreakpointsTreeCellRenderer.java

示例12: decorate

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
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);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:CoverageProjectViewDirectoryNodeDecorator.java

示例13: customizeRenderer

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
@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));
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:BreakpointsFavoriteListProvider.java

示例14: customizeRenderer

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
@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);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:ExtensionTreeCellRenderer.java

示例15: render

import com.intellij.ui.ColoredTreeCellRenderer; //导入依赖的package包/类
@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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:SingleRepositoryNode.java


注:本文中的com.intellij.ui.ColoredTreeCellRenderer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。