use of com.intellij.ide.favoritesTreeView.FavoritesViewTreeBuilder in project intellij-community by JetBrains.
the class EditFavoritesAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
FavoritesViewTreeBuilder treeBuilder = FavoritesTreeViewPanel.FAVORITES_TREE_BUILDER_KEY.getData(e.getDataContext());
String listName = FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(e.getDataContext());
if (project == null || treeBuilder == null || listName == null) {
return;
}
FavoritesManager favoritesManager = FavoritesManager.getInstance(project);
FavoritesListProvider provider = favoritesManager.getListProvider(listName);
Set<Object> selection = treeBuilder.getSelectedElements();
if (provider != null && provider.willHandle(CommonActionsPanel.Buttons.EDIT, project, selection)) {
provider.handle(CommonActionsPanel.Buttons.EDIT, project, selection, treeBuilder.getTree());
return;
}
favoritesManager.renameList(project, listName);
}
use of com.intellij.ide.favoritesTreeView.FavoritesViewTreeBuilder in project intellij-community by JetBrains.
the class EditFavoritesAction method update.
@Override
public void update(AnActionEvent e) {
e.getPresentation().setText(getTemplatePresentation().getText());
e.getPresentation().setIcon(CommonActionsPanel.Buttons.EDIT.getIcon());
e.getPresentation().setEnabled(true);
Project project = e.getProject();
FavoritesViewTreeBuilder treeBuilder = FavoritesTreeViewPanel.FAVORITES_TREE_BUILDER_KEY.getData(e.getDataContext());
String listName = FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(e.getDataContext());
if (project == null || treeBuilder == null || listName == null) {
e.getPresentation().setEnabled(false);
return;
}
FavoritesManager favoritesManager = FavoritesManager.getInstance(project);
FavoritesListProvider provider = favoritesManager.getListProvider(listName);
Set<Object> selection = treeBuilder.getSelectedElements();
if (provider != null) {
e.getPresentation().setEnabled(provider.willHandle(CommonActionsPanel.Buttons.EDIT, project, selection));
e.getPresentation().setText(provider.getCustomName(CommonActionsPanel.Buttons.EDIT));
}
}
Aggregations