use of com.intellij.ide.IconLayerProvider in project intellij-community by JetBrains.
the class ElementPresentationUtil method getFlagsDescription.
private static String getFlagsDescription(final PsiModifierListOwner aClass) {
int flags = getFlags(aClass, false);
String adj = "";
for (IconLayerProvider provider : Extensions.getExtensions(IconLayerProvider.EP_NAME)) {
if (provider.getLayerIcon(aClass, false) != null) {
adj += " " + provider.getLayerDescription();
}
}
if (BitUtil.isSet(flags, FLAGS_ABSTRACT))
adj += " " + CodeInsightBundle.message("node.abstract.flag.tooltip");
if (BitUtil.isSet(flags, FLAGS_FINAL))
adj += " " + CodeInsightBundle.message("node.final.flag.tooltip");
if (BitUtil.isSet(flags, FLAGS_STATIC))
adj += " " + CodeInsightBundle.message("node.static.flag.tooltip");
PsiModifierList list = aClass.getModifierList();
if (list != null) {
int level = PsiUtil.getAccessLevel(list);
if (level != PsiUtil.ACCESS_LEVEL_PUBLIC) {
adj += " " + StringUtil.capitalize(PsiBundle.visibilityPresentation(PsiUtil.getAccessModifier(level)));
}
}
return adj;
}
use of com.intellij.ide.IconLayerProvider 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;
}
Aggregations