本文整理汇总了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;
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
};
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
}
示例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());
}
示例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);
}
示例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());
}
示例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());
}
示例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();
}
};
}