com.intellij.openapi.roots.ui.CellAppearanceEx Java Examples
The following examples show how to use
com.intellij.openapi.roots.ui.CellAppearanceEx.
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: AnalyzeDependenciesComponent.java From consulo with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public CellAppearanceEx getAppearance(boolean selected, final boolean isBold) { if (myExplanation.entry() instanceof ModuleSourceOrderEntry) { ModuleSourceOrderEntry e = (ModuleSourceOrderEntry)myExplanation.entry(); if (e.getOwnerModule() == myModule) { return new CellAppearanceEx() { @Override public void customize(@Nonnull SimpleColoredComponent component) { component.setIcon(AllIcons.Nodes.Module); component.append("<This Module>", SimpleTextAttributes.SYNTHETIC_ATTRIBUTES); } @Nonnull @Override public String getText() { return "<This Module>"; } }; } else { return OrderEntryAppearanceService.getInstance().forModule(e.getOwnerModule()); } } return OrderEntryAppearanceService.getInstance().forOrderEntry(myExplanation.entry()); }
Example #2
Source File: AnalyzeDependenciesComponent.java From consulo with Apache License 2.0 | 6 votes |
@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); }
Example #3
Source File: AnalyzeDependenciesComponent.java From consulo with Apache License 2.0 | 6 votes |
/** * 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(); }
Example #4
Source File: ProjectLibraryTabContext.java From consulo with Apache License 2.0 | 6 votes |
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); }
Example #5
Source File: NamedLibraryElementNode.java From consulo with Apache License 2.0 | 5 votes |
@Override public void update(PresentationData presentation) { presentation.setPresentableText(getValue().getName()); final OrderEntry orderEntry = getValue().getOrderEntry(); if (orderEntry instanceof ModuleExtensionWithSdkOrderEntry) { final ModuleExtensionWithSdkOrderEntry sdkOrderEntry = (ModuleExtensionWithSdkOrderEntry)orderEntry; final Sdk sdk = sdkOrderEntry.getSdk(); presentation.setIcon(SdkUtil.getIcon(((ModuleExtensionWithSdkOrderEntry)orderEntry).getSdk())); if (sdk != null) { //jdk not specified final String path = sdk.getHomePath(); if (path != null) { presentation.setLocationString(FileUtil.toSystemDependentName(path)); } } presentation.setTooltip(null); } else if (orderEntry instanceof LibraryOrderEntry) { presentation.setIcon(getIconForLibrary(orderEntry)); presentation.setTooltip(StringUtil.capitalize(IdeBundle.message("node.projectview.library", ((LibraryOrderEntry)orderEntry).getLibraryLevel()))); } else if(orderEntry instanceof OrderEntryWithTracking) { Image icon = null; CellAppearanceEx cellAppearance = OrderEntryAppearanceService.getInstance().forOrderEntry(orderEntry); if(cellAppearance instanceof ModifiableCellAppearanceEx) { icon = ((ModifiableCellAppearanceEx)cellAppearance).getIcon(); } presentation.setIcon(icon == null ? AllIcons.Toolbar.Unknown : icon); } }
Example #6
Source File: ChooseLibrariesDialogBase.java From consulo with Apache License 2.0 | 5 votes |
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(TargetAWT.from(coloredComponent.getIcon())); templatePresentation.addText(notEmpty(appearance.getText()), SimpleTextAttributes.REGULAR_ATTRIBUTES); }
Example #7
Source File: AnalyzeDependenciesComponent.java From consulo with Apache License 2.0 | 5 votes |
/** * {@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); } @Nonnull @Override public String getText() { return getDisplayName(); } }; }
Example #8
Source File: LibraryOrderEntryTypeEditor.java From consulo with Apache License 2.0 | 5 votes |
@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()); }
Example #9
Source File: ModuleLibraryOrderEntryTypeEditor.java From consulo with Apache License 2.0 | 5 votes |
@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()); }
Example #10
Source File: ModuleOrderEntryTypeEditor.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override public CellAppearanceEx getCellAppearance(@Nonnull ModuleOrderEntryImpl orderEntry) { return SimpleTextCellAppearance.regular(orderEntry.getPresentableName(), AllIcons.Nodes.Module); }
Example #11
Source File: UnknownOrderEntryTypeEditor.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override public CellAppearanceEx getCellAppearance(@Nonnull UnknownOrderEntryImpl orderEntry) { return SimpleTextCellAppearance.invalid(orderEntry.getPresentableName(), AllIcons.Toolbar.Unknown); }
Example #12
Source File: OrderEntryTypeEditor.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull default CellAppearanceEx getCellAppearance(@Nonnull T orderEntry) { return new SimpleTextCellAppearance(orderEntry.getPresentableName(), null, SimpleTextAttributes.REGULAR_ATTRIBUTES); }
Example #13
Source File: ModuleSourceOrderEntryTypeEditor.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override public CellAppearanceEx getCellAppearance(@Nonnull ModuleSourceOrderEntryImpl orderEntry) { return SimpleTextCellAppearance.synthetic(orderEntry.getPresentableName(), AllIcons.Nodes.Module); }
Example #14
Source File: ModuleExtensionWithSdkOrderEntryTypeEditor.java From consulo with Apache License 2.0 | 4 votes |
@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); }
Example #15
Source File: ModuleDependenciesAnalyzer.java From consulo with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Nonnull @Override public CellAppearanceEx getAppearance(boolean isSelected) { return OrderEntryAppearanceService.getInstance().forOrderEntry(myEntry); }
Example #16
Source File: ClasspathPanelImpl.java From consulo with Apache License 2.0 | 4 votes |
private static CellAppearanceEx getCellAppearance(final ClasspathTableItem<?> item, final StructureConfigurableContext context, final boolean selected) { final OrderEntryAppearanceService service = OrderEntryAppearanceService.getInstance(); final OrderEntry entry = item.getEntry(); return service.forOrderEntry(entry); }
Example #17
Source File: Unity3dPackageOrderEntryTypeEditor.java From consulo-unity3d with Apache License 2.0 | 4 votes |
@Nonnull @Override public CellAppearanceEx getCellAppearance(@Nonnull Unity3dPackageOrderEntry dotNetLibraryOrderEntry) { return SimpleTextCellAppearance.synthetic(dotNetLibraryOrderEntry.getPresentableName(), Unity3dIcons.Unity3d); }
Example #18
Source File: AbstractSlingServerNodeDescriptor.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 4 votes |
public CellAppearanceEx getHighlightedText() { return myHighlightedText; }
Example #19
Source File: AnalyzeDependenciesComponent.java From consulo with Apache License 2.0 | 2 votes |
/** * Get appearance for rendering in master list * * @param selected true if selected * @param bold true if bold * @return the result appearance */ public abstract CellAppearanceEx getAppearance(boolean selected, boolean bold);
Example #20
Source File: ModuleDependenciesAnalyzer.java From consulo with Apache License 2.0 | 2 votes |
/** * Get appearance for path element * * @param isSelected true if the element is selected * @return the appearance to use for rendering */ @Nonnull public abstract CellAppearanceEx getAppearance(boolean isSelected);