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;
}
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);
}
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;
}
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));
}
}
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);
}
Aggregations