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


Java CellAppearanceEx类代码示例

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


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

示例1: forNodeDescriptorInTree

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
public static CellAppearanceEx forNodeDescriptorInTree(Object node, boolean expanded) {
  NodeDescriptor descriptor = getNodeDescriptor(node);
  if (descriptor == null) return FileAppearanceService.getInstance().empty();
  String name = descriptor.toString();
  Object psiElement = descriptor.getElement();
  ModifiableCellAppearanceEx result;
  if (psiElement instanceof PsiElement && !((PsiElement)psiElement).isValid()) {
    result = CompositeAppearance.single(name);
  }
  else {
    PsiClass psiClass = getContainingClass(psiElement);
    if (isInheritedMember(node, psiClass) && psiClass != null) {
      CompositeAppearance.DequeEnd ending = new CompositeAppearance().getEnding();
      ending.addText(name, applyDeprecation(psiElement, SimpleTextAttributes.DARK_TEXT));
      ending.addComment(psiClass.getName(), applyDeprecation(psiClass, SimpleTextAttributes.GRAY_ATTRIBUTES));
      result = ending.getAppearance();
    }
    else {
      SimpleTextAttributes textAttributes = applyDeprecation(psiElement, SimpleTextAttributes.REGULAR_ATTRIBUTES);
      result = CompositeAppearance.single(name, textAttributes);
    }
  }

  result.setIcon(descriptor.getIcon());
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:StructureNodeRenderer.java

示例2: init

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
/**
 * Initialize components
 */
private void init() {
  myTree.setCellRenderer(new ColoredTreeCellRenderer() {
    @Override
    public void customizeCellRenderer(JTree tree,
                                      Object value,
                                      boolean selected,
                                      boolean expanded,
                                      boolean leaf,
                                      int row,
                                      boolean hasFocus) {
      //if(getBackground() == null) {
      //  setBackground(UIUtil.getTreeTextBackground());
      //}
      if (value instanceof MyNode && !(value instanceof MyRootNode)) {
        final MyNode node = (MyNode)value;
        PathNode<?> n = (PathNode<?>)node.getUserObject();
        CellAppearanceEx a = n.getAppearance(selected, node.isDisplayInBold());
        a.customize(this);
      }
    }
  });
  myTree.setShowsRootHandles(false);
  myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  reloadTree();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AnalyzeDependenciesComponent.java

示例3: customizeCellRenderer

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
@Override
public void customizeCellRenderer(JTree tree,
                                  Object value,
                                  boolean selected,
                                  boolean expanded,
                                  boolean leaf,
                                  int row,
                                  boolean hasFocus) {
  DefaultMutableTreeNode n = (DefaultMutableTreeNode)value;
  final Object userObject = n.getUserObject();
  if (!(userObject instanceof ModuleDependenciesAnalyzer.OrderPathElement)) {
    return;
  }
  ModuleDependenciesAnalyzer.OrderPathElement e = (ModuleDependenciesAnalyzer.OrderPathElement)userObject;
  final CellAppearanceEx appearance = e.getAppearance(selected);
  appearance.customize(this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AnalyzeDependenciesComponent.java

示例4: getCellAppearance

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
@NotNull
private static CellAppearanceEx getCellAppearance(@NotNull final ModuleDependenciesTableItem item) {
  BuildFileStatement entry = item.getEntry();
  String data = "";
  Icon icon = null;
  if (entry instanceof Dependency) {
    Dependency dependency = (Dependency)entry;
    data = dependency.getValueAsString();
    //noinspection EnumSwitchStatementWhichMissesCases
    switch (dependency.type) {
      case EXTERNAL:
        icon = AndroidIcons.MavenLogo;
        break;
      case FILES:
        icon = PlatformIcons.LIBRARY_ICON;
        break;
      case MODULE:
        icon = AllIcons.Nodes.Module;
        break;
    }
  } else if (entry != null) {
    data = entry.toString();
  }
  return SimpleTextCellAppearance.regular(data, icon);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ModuleDependenciesPanel.java

示例5: ProjectLibraryTabContext

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
public ProjectLibraryTabContext(final ClasspathPanel classpathPanel, StructureConfigurableContext context) {
  super(classpathPanel, context);

  StructureLibraryTableModifiableModelProvider projectLibrariesProvider = context.getProjectLibrariesProvider();
  Library[] libraries = projectLibrariesProvider.getModifiableModel().getLibraries();
  final Condition<Library> condition = LibraryEditingUtil.getNotAddedLibrariesCondition(myClasspathPanel.getRootModel());

  myItems = ContainerUtil.filter(libraries, condition);
  ContainerUtil.sort(myItems, new Comparator<Library>() {
    @Override
    public int compare(Library o1, Library o2) {
      return StringUtil.compare(o1.getName(), o2.getName(), false);
    }
  });

  myLibraryList = new JBList(myItems);
  myLibraryList.setCellRenderer(new ColoredListCellRendererWrapper<Library>() {
    @Override
    protected void doCustomize(JList list, Library value, int index, boolean selected, boolean hasFocus) {
      final CellAppearanceEx appearance = OrderEntryAppearanceService.getInstance().forLibrary(classpathPanel.getProject(), value, false);

      appearance.customize(this);
    }
  });
  new ListSpeedSearch(myLibraryList);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:ProjectLibraryTabContext.java

示例6: getAppearance

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public CellAppearanceEx getAppearance(boolean selected, final boolean isBold) {
  return new CellAppearanceEx() {
    @Override
    public void customize(@NotNull SimpleColoredComponent component) {
      component.setIcon(getIcon());
      final Font font = UIUtil.getTreeFont();
      if (isBold) {
        component.setFont(font.deriveFont(Font.BOLD));
      }
      else {
        component.setFont(font.deriveFont(Font.PLAIN));
      }
      final String p = PathUtil.toPresentableUrl(getEditableObject().url());
      component.append(PathUtil.getFileName(p),
                       isBold ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
      component.append(" (" + PathUtil.getParentPath(p) + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
    }

    @Override
    public void customize(@NotNull final HtmlListCellRenderer renderer) {
      throw new UnsupportedOperationException("Rendering in combo box not supported yet.");
    }

    @NotNull
    @Override
    public String getText() {
      return getDisplayName();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:AnalyzeDependenciesComponent.java

示例7: getCellAppearance

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
static CellAppearanceEx getCellAppearance(final ClasspathTableItem<?> item,
                                          final StructureConfigurableContext context,
                                          final boolean selected) {
  final OrderEntryAppearanceService service = OrderEntryAppearanceService.getInstance();
  if (item instanceof InvalidJdkItem) {
    return service.forJdk(null, false, selected, true);
  }
  else {
    final OrderEntry entry = item.getEntry();
    assert entry != null : item;
    return service.forOrderEntry(context.getProject(), entry, selected);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ClasspathPanelImpl.java

示例8: LibraryDescriptor

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
protected LibraryDescriptor(final Project project, final NodeDescriptor parentDescriptor, final Library element) {
  super(project, parentDescriptor, element);
  final CellAppearanceEx appearance = OrderEntryAppearanceService.getInstance().forLibrary(project, element, false);
  final SimpleColoredComponent coloredComponent = new SimpleColoredComponent();
  appearance.customize(coloredComponent);
  final PresentationData templatePresentation = getTemplatePresentation();
  templatePresentation.setIcon(coloredComponent.getIcon());
  templatePresentation.addText(notEmpty(appearance.getText()), SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ChooseLibrariesDialogBase.java

示例9: getAppearance

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
public CellAppearanceEx getAppearance() {
  CellAppearanceEx appearance = FileAppearanceService.getInstance().forIoFile(myDir);
  if (appearance instanceof ModifiableCellAppearanceEx) {
    ((ModifiableCellAppearanceEx)appearance).setIcon(AllIcons.Nodes.JarDirectory);
  }
  return appearance;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AllJarsUnderDirEntry.java

示例10: getCellAppearance

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
private static CellAppearanceEx getCellAppearance(final ClasspathTableItem<?> item,
                                                  final StructureConfigurableContext context,
                                                  final boolean selected) {
  final OrderEntryAppearanceService service = OrderEntryAppearanceService.getInstance();
  if (item instanceof InvalidJdkItem) {
    return service.forJdk(null, false, selected, true);
  }
  else {
    final OrderEntry entry = item.getEntry();
    assert entry != null : item;
    return service.forOrderEntry(context.getProject(), entry, selected);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:ClasspathPanelImpl.java

示例11: getCellAppearance

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
@NotNull
@Override
public CellAppearanceEx getCellAppearance(@NotNull DotNetLibraryOrderEntryImpl dotNetLibraryOrderEntry)
{
	ModuleRootLayerImpl moduleRootLayer = dotNetLibraryOrderEntry.getModuleRootLayer();

	DotNetSimpleModuleExtension extension = moduleRootLayer.getExtension(DotNetSimpleModuleExtension.class);

	ModuleExtensionProviderEP providerEP = extension == null ? null : ModuleExtensionProviders.findProvider(extension.getId());

	return SimpleTextCellAppearance.synthetic(dotNetLibraryOrderEntry.getPresentableName(), providerEP == null ? AllIcons.Toolbar.Unknown :
			providerEP.getIcon());
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:14,代码来源:DotNetLibraryOrderEntryTypeEditor.java

示例12: getCellAppearance

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
@Nonnull
@Override
public CellAppearanceEx getCellAppearance(@Nonnull ModuleExtensionWithSdkOrderEntryImpl orderEntry) {
  Sdk sdk = orderEntry.getSdk();
  return new SimpleTextCellAppearance(orderEntry.getPresentableName(), SdkUtil.getIcon(sdk),
                                      sdk == null ? SimpleTextAttributes.ERROR_ATTRIBUTES : SimpleTextAttributes.SYNTHETIC_ATTRIBUTES);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:ModuleExtensionWithSdkOrderEntryTypeEditor.java

示例13: getCellAppearance

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
@Nonnull
@Override
public CellAppearanceEx getCellAppearance(@Nonnull ModuleLibraryOrderEntryImpl orderEntry) {
  if (!orderEntry.isValid()) { //library can be removed
    return FileAppearanceService.getInstance().forInvalidUrl(orderEntry.getPresentableName());
  }
  Library library = orderEntry.getLibrary();
  assert library != null : orderEntry;
  return OrderEntryAppearanceService.getInstance().forLibrary(orderEntry.getModuleRootLayer().getProject(), library,
                                                              !((LibraryEx)library).getInvalidRootUrls(BinariesOrderRootType.getInstance()).isEmpty());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:ModuleLibraryOrderEntryTypeEditor.java

示例14: getCellAppearance

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
@Nonnull
@Override
public CellAppearanceEx getCellAppearance(@Nonnull LibraryOrderEntryImpl orderEntry) {
  if (!orderEntry.isValid()) { //library can be removed
    return FileAppearanceService.getInstance().forInvalidUrl(orderEntry.getPresentableName());
  }
  Library library = orderEntry.getLibrary();
  assert library != null : orderEntry;
  return OrderEntryAppearanceService.getInstance().forLibrary(orderEntry.getModuleRootLayer().getProject(), library,
                                                              !((LibraryEx)library).getInvalidRootUrls(BinariesOrderRootType.getInstance()).isEmpty());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:LibraryOrderEntryTypeEditor.java

示例15: getAppearance

import com.intellij.openapi.roots.ui.CellAppearanceEx; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public CellAppearanceEx getAppearance(boolean selected, final boolean isBold) {
  return new CellAppearanceEx() {
    @Override
    public void customize(@Nonnull SimpleColoredComponent component) {
      component.setIcon(getIcon());
      final Font font = UIUtil.getTreeFont();
      if (isBold) {
        component.setFont(font.deriveFont(Font.BOLD));
      }
      else {
        component.setFont(font.deriveFont(Font.PLAIN));
      }
      final String p = PathUtil.toPresentableUrl(getEditableObject().url());
      component.append(PathUtil.getFileName(p),
                       isBold ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
      component.append(" (" + PathUtil.getParentPath(p) + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
    }

    @Override
    public void customize(@Nonnull final HtmlListCellRenderer renderer) {
      throw new UnsupportedOperationException("Rendering in combo box not supported yet.");
    }

    @Nonnull
    @Override
    public String getText() {
      return getDisplayName();
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:35,代码来源:AnalyzeDependenciesComponent.java


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