mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
don't show favorites for categories
This commit is contained in:
@@ -567,26 +567,30 @@ 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 =
|
||||||
final boolean isFavorite = favorites != null && favorites.indexOf(fav) >= 0;
|
new Favorite(componentType == null ? FavoriteType.Block : FavoriteType.Component,
|
||||||
final JMenuItem favoritesItem = new JMenuItem(isFavorite ? "Remove From Favorites" : "Add To Favorites",
|
componentType == null ? payload.toString() : componentType.getInstanceClass().getCanonicalName());
|
||||||
isFavorite ? IconLoader.StarBlue.getIcon() : IconLoader.StarGrey.getIcon());
|
final boolean isFavorite = favorites != null && favorites.indexOf(fav) >= 0;
|
||||||
favoritesItem.addActionListener(new ActionListener() {
|
final JMenuItem favoritesItem =
|
||||||
|
new JMenuItem(isFavorite ? "Remove From Favorites" : "Add To Favorites",
|
||||||
@Override
|
isFavorite ? IconLoader.StarBlue.getIcon() : IconLoader.StarGrey.getIcon());
|
||||||
public void actionPerformed(ActionEvent e) {
|
favoritesItem.addActionListener(new ActionListener() {
|
||||||
List<Favorite> favorites = new ArrayList<Favorite>(TreePanel.this.favorites);
|
|
||||||
if (isFavorite) {
|
@Override
|
||||||
favorites.remove(fav);
|
public void actionPerformed(ActionEvent e) {
|
||||||
} else {
|
List<Favorite> favorites = new ArrayList<Favorite>(TreePanel.this.favorites);
|
||||||
favorites.add(fav);
|
if (isFavorite) {
|
||||||
Collections.sort(favorites);
|
favorites.remove(fav);
|
||||||
|
} else {
|
||||||
|
favorites.add(fav);
|
||||||
|
Collections.sort(favorites);
|
||||||
|
}
|
||||||
|
ConfigurationManager.getInstance().writeValue(IPlugInPort.FAVORITES_KEY, favorites);
|
||||||
}
|
}
|
||||||
ConfigurationManager.getInstance().writeValue(IPlugInPort.FAVORITES_KEY, favorites);
|
});
|
||||||
}
|
popup.add(favoritesItem);
|
||||||
});
|
}
|
||||||
popup.add(favoritesItem);
|
|
||||||
|
|
||||||
if (componentType != null) {
|
if (componentType != null) {
|
||||||
popup.add(new SelectAllAction(plugInPort, componentType));
|
popup.add(new SelectAllAction(plugInPort, componentType));
|
||||||
|
|||||||
Reference in New Issue
Block a user