Search in sources :

Example 26 with RowIcon

use of com.intellij.ui.RowIcon in project intellij-community by JetBrains.

the class ElementBase method createLayeredIcon.

@NotNull
public static RowIcon createLayeredIcon(@NotNull Iconable instance, Icon icon, int flags) {
    List<Icon> layersFromProviders = new SmartList<>();
    for (IconLayerProvider provider : Extensions.getExtensions(IconLayerProvider.EP_NAME)) {
        final Icon layerIcon = provider.getLayerIcon(instance, BitUtil.isSet(flags, FLAGS_LOCKED));
        if (layerIcon != null) {
            layersFromProviders.add(layerIcon);
        }
    }
    if (flags != 0 || !layersFromProviders.isEmpty()) {
        List<Icon> iconLayers = new SmartList<>();
        for (IconLayer l : ourIconLayers) {
            if (BitUtil.isSet(flags, l.flagMask)) {
                iconLayers.add(l.icon);
            }
        }
        iconLayers.addAll(layersFromProviders);
        LayeredIcon layeredIcon = new LayeredIcon(1 + iconLayers.size());
        layeredIcon.setIcon(icon, 0);
        for (int i = 0; i < iconLayers.size(); i++) {
            Icon icon1 = iconLayers.get(i);
            layeredIcon.setIcon(icon1, i + 1);
        }
        icon = layeredIcon;
    }
    RowIcon baseIcon = new RowIcon(2);
    baseIcon.setIcon(icon, 0);
    return baseIcon;
}
Also used : IconLayerProvider(com.intellij.ide.IconLayerProvider) LayeredIcon(com.intellij.ui.LayeredIcon) RowIcon(com.intellij.ui.RowIcon) EmptyIcon(com.intellij.util.ui.EmptyIcon) LayeredIcon(com.intellij.ui.LayeredIcon) RowIcon(com.intellij.ui.RowIcon) NotNull(org.jetbrains.annotations.NotNull)

Example 27 with RowIcon

use of com.intellij.ui.RowIcon in project intellij-community by JetBrains.

the class GrMethodBaseImpl method getElementIcon.

@Nullable
@Override
protected Icon getElementIcon(@IconFlags int flags) {
    Icon methodIcon = hasModifierProperty(PsiModifier.ABSTRACT) ? JetgroovyIcons.Groovy.AbstractMethod : JetgroovyIcons.Groovy.Method;
    RowIcon baseIcon = ElementPresentationUtil.createLayeredIcon(methodIcon, this, false);
    return ElementPresentationUtil.addVisibilityIcon(this, flags, baseIcon);
}
Also used : RowIcon(com.intellij.ui.RowIcon) RowIcon(com.intellij.ui.RowIcon) Nullable(org.jetbrains.annotations.Nullable)

Example 28 with RowIcon

use of com.intellij.ui.RowIcon in project intellij-community by JetBrains.

the class AbstractPsiBasedNode method patchIcon.

@Nullable
public static Icon patchIcon(@NotNull Project project, @Nullable Icon original, @Nullable VirtualFile file) {
    if (file == null || original == null)
        return original;
    Icon icon = original;
    final Bookmark bookmarkAtFile = BookmarkManager.getInstance(project).findFileBookmark(file);
    if (bookmarkAtFile != null) {
        final RowIcon composite = new RowIcon(2, RowIcon.Alignment.CENTER);
        composite.setIcon(icon, 0);
        composite.setIcon(bookmarkAtFile.getIcon(), 1);
        icon = composite;
    }
    if (!file.isWritable()) {
        icon = LayeredIcon.create(icon, PlatformIcons.LOCKED_ICON);
    }
    if (file.is(VFileProperty.SYMLINK)) {
        icon = LayeredIcon.create(icon, PlatformIcons.SYMLINK_ICON);
    }
    return icon;
}
Also used : Bookmark(com.intellij.ide.bookmarks.Bookmark) RowIcon(com.intellij.ui.RowIcon) LayeredIcon(com.intellij.ui.LayeredIcon) RowIcon(com.intellij.ui.RowIcon) Nullable(org.jetbrains.annotations.Nullable)

Example 29 with RowIcon

use of com.intellij.ui.RowIcon in project intellij-community by JetBrains.

the class BookmarksFavoriteListProvider method customizeRenderer.

@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) {
            RowIcon icon = new RowIcon(3, RowIcon.Alignment.CENTER);
            icon.setIcon(bookmark.getIcon(), 0);
            icon.setIcon(JBUI.scale(EmptyIcon.create(1)), 1);
            icon.setIcon(renderer.getIcon(), 2);
            renderer.setIcon(icon);
        } else {
            renderer.setIcon(bookmark.getIcon());
        }
    } else {
        renderer.append(getListName(myProject));
    }
}
Also used : RowIcon(com.intellij.ui.RowIcon)

Example 30 with RowIcon

use of com.intellij.ui.RowIcon in project intellij-community by JetBrains.

the class LightMethod method getElementIcon.

@Override
public Icon getElementIcon(final int flags) {
    Icon methodIcon = hasModifierProperty(PsiModifier.ABSTRACT) ? PlatformIcons.ABSTRACT_METHOD_ICON : PlatformIcons.METHOD_ICON;
    RowIcon baseIcon = ElementPresentationUtil.createLayeredIcon(methodIcon, this, false);
    return ElementPresentationUtil.addVisibilityIcon(this, flags, baseIcon);
}
Also used : RowIcon(com.intellij.ui.RowIcon) RowIcon(com.intellij.ui.RowIcon)

Aggregations

RowIcon (com.intellij.ui.RowIcon)34 Nullable (org.jetbrains.annotations.Nullable)10 LayeredIcon (com.intellij.ui.LayeredIcon)7 NotNull (org.jetbrains.annotations.NotNull)7 EmptyIcon (com.intellij.util.ui.EmptyIcon)4 ItemPresentation (com.intellij.navigation.ItemPresentation)2 CompositeAppearance (com.intellij.openapi.roots.ui.util.CompositeAppearance)2 PsiFile (com.intellij.psi.PsiFile)2 LookupElementBuilder (com.intellij.codeInsight.lookup.LookupElementBuilder)1 IconLayerProvider (com.intellij.ide.IconLayerProvider)1 Bookmark (com.intellij.ide.bookmarks.Bookmark)1 AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)1 StructureViewTestUtil.getIcon (com.intellij.lang.javascript.StructureViewTestUtil.getIcon)1 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)1 FlexBuildConfigurationManager (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager)1 SimpleDataContext (com.intellij.openapi.actionSystem.impl.SimpleDataContext)1 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiElement (com.intellij.psi.PsiElement)1 CandidateInfo (com.intellij.psi.infos.CandidateInfo)1