don't show favorites for categories

This commit is contained in:
Branislav Stojkovic
2019-03-09 11:27:15 +01:00
parent 81e259bb62
commit c893b37fdf
@@ -567,10 +567,13 @@ public class TreePanel extends JPanel {
shortcutSubmenu.add(item); shortcutSubmenu.add(item);
} }
final Favorite fav = new Favorite(componentType == null ? FavoriteType.Block : FavoriteType.Component, componentType == null ? payload.toString() : componentType.getInstanceClass() if (selectedNode.isLeaf()) {
.getCanonicalName()); final Favorite fav =
new Favorite(componentType == null ? FavoriteType.Block : FavoriteType.Component,
componentType == null ? payload.toString() : componentType.getInstanceClass().getCanonicalName());
final boolean isFavorite = favorites != null && favorites.indexOf(fav) >= 0; final boolean isFavorite = favorites != null && favorites.indexOf(fav) >= 0;
final JMenuItem favoritesItem = new JMenuItem(isFavorite ? "Remove From Favorites" : "Add To Favorites", final JMenuItem favoritesItem =
new JMenuItem(isFavorite ? "Remove From Favorites" : "Add To Favorites",
isFavorite ? IconLoader.StarBlue.getIcon() : IconLoader.StarGrey.getIcon()); isFavorite ? IconLoader.StarBlue.getIcon() : IconLoader.StarGrey.getIcon());
favoritesItem.addActionListener(new ActionListener() { favoritesItem.addActionListener(new ActionListener() {
@@ -587,6 +590,7 @@ public class TreePanel extends JPanel {
} }
}); });
popup.add(favoritesItem); popup.add(favoritesItem);
}
if (componentType != null) { if (componentType != null) {
popup.add(new SelectAllAction(plugInPort, componentType)); popup.add(new SelectAllAction(plugInPort, componentType));