use of com.intellij.ide.favoritesTreeView.FavoritesListNode in project intellij-community by JetBrains.
the class SendToFavoritesAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
Project project = e.getProject();
final FavoritesManager favoritesManager = FavoritesManager.getInstance(project);
FavoritesTreeNodeDescriptor[] roots = FavoritesTreeViewPanel.CONTEXT_FAVORITES_ROOTS_DATA_KEY.getData(dataContext);
if (roots == null)
return;
for (FavoritesTreeNodeDescriptor root : roots) {
FavoritesTreeNodeDescriptor listNode = root.getFavoritesRoot();
if (listNode != null && listNode != root && listNode.getElement() instanceof FavoritesListNode) {
doSend(favoritesManager, new FavoritesTreeNodeDescriptor[] { root }, listNode.getElement().getName());
}
}
}
use of com.intellij.ide.favoritesTreeView.FavoritesListNode in project intellij-community by JetBrains.
the class SendToFavoritesAction method isEnabled.
static boolean isEnabled(AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return false;
}
FavoritesTreeNodeDescriptor[] roots = FavoritesTreeViewPanel.CONTEXT_FAVORITES_ROOTS_DATA_KEY.getData(e.getDataContext());
if (roots == null || roots.length == 0) {
return false;
}
for (FavoritesTreeNodeDescriptor root : roots) {
FavoritesTreeNodeDescriptor listNode = root.getFavoritesRoot();
if (listNode == null || listNode == root || !(listNode.getElement() instanceof FavoritesListNode))
return false;
}
return true;
}
Aggregations