本文整理汇总了Java中com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel类的典型用法代码示例。如果您正苦于以下问题:Java FavoritesTreeViewPanel类的具体用法?Java FavoritesTreeViewPanel怎么用?Java FavoritesTreeViewPanel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FavoritesTreeViewPanel类属于com.intellij.ide.favoritesTreeView包,在下文中一共展示了FavoritesTreeViewPanel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getChildren
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@Override
@NotNull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e == null) {
return EMPTY_ARRAY;
}
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
final List<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
availableFavoritesLists.remove(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(e.getDataContext()));
if (availableFavoritesLists.isEmpty()) {
return new AnAction[]{new SendToNewFavoritesListAction()};
}
List<AnAction> actions = new ArrayList<AnAction>();
for (String list : availableFavoritesLists) {
actions.add(new SendToFavoritesAction(list));
}
actions.add(Separator.getInstance());
actions.add(new SendToNewFavoritesListAction());
return actions.toArray(new AnAction[actions.size()]);
}
示例2: canCreateNodes
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
public static boolean canCreateNodes(AnActionEvent e, @Nullable String listName) {
DataContext dataContext = e.getDataContext();
if (e.getProject() == null) {
return false;
}
if (e.getPlace().equals(ActionPlaces.FAVORITES_VIEW_POPUP)
&& FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(dataContext) == null) {
return false;
}
final boolean inProjectView = e.getPlace().equals(ActionPlaces.J2EE_VIEW_POPUP) ||
e.getPlace().equals(ActionPlaces.STRUCTURE_VIEW_POPUP) ||
e.getPlace().equals(ActionPlaces.PROJECT_VIEW_POPUP);
//com.intellij.openapi.actionSystem.ActionPlaces.USAGE_VIEW_TOOLBAR
Collection<AbstractTreeNode> nodes = getNodesToAdd(dataContext, inProjectView);
if (listName != null && !nodes.isEmpty()) {
return FavoritesManager.getInstance(e.getProject()).canAddRoots(listName, nodes);
}
return !nodes.isEmpty();
}
示例3: getChildren
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@Override
@NotNull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e == null) return AnAction.EMPTY_ARRAY;
final Project project = e.getProject();
if (project == null) {
return AnAction.EMPTY_ARRAY;
}
final List<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
availableFavoritesLists.remove(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(e.getDataContext()));
if (availableFavoritesLists.isEmpty()) {
return new AnAction[]{new AddToNewFavoritesListAction()};
}
AnAction[] actions = new AnAction[availableFavoritesLists.size() + 2];
int idx = 0;
for (String favoritesList : availableFavoritesLists) {
actions[idx++] = new AddToFavoritesAction(favoritesList);
}
actions[idx++] = Separator.getInstance();
actions[idx] = new AddToNewFavoritesListAction();
return actions;
}
示例4: getChildren
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@Override
@NotNull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e == null) return AnAction.EMPTY_ARRAY;
final Project project = e.getProject();
if (project == null) {
return AnAction.EMPTY_ARRAY;
}
final List<String> listNames = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
final List<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
availableFavoritesLists.remove(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(e.getDataContext()));
if (availableFavoritesLists.isEmpty()) {
return new AnAction[]{new AddAllOpenFilesToNewFavoritesListAction()};
}
AnAction[] actions = new AnAction[listNames.size() + 2];
int idx = 0;
for (String favoritesList : listNames) {
actions[idx++] = new AddAllOpenFilesToFavorites(favoritesList);
}
actions[idx++] = Separator.getInstance();
actions[idx] = new AddAllOpenFilesToNewFavoritesListAction();
return actions;
}
示例5: actionPerformed
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@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());
}
}
}
示例6: isEnabled
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
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;
}
示例7: actionPerformed
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@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);
}
示例8: update
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@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));
}
}
示例9: getChildren
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@Override
@NotNull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e == null) {
return EMPTY_ARRAY;
}
final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
final List<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
availableFavoritesLists.remove(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(e.getDataContext()));
if (availableFavoritesLists.isEmpty()) {
return new AnAction[]{new SendToNewFavoritesListAction()};
}
List<AnAction> actions = new ArrayList<AnAction>();
for (String list : availableFavoritesLists) {
actions.add(new SendToFavoritesAction(list));
}
actions.add(Separator.getInstance());
actions.add(new SendToNewFavoritesListAction());
return actions.toArray(new AnAction[actions.size()]);
}
示例10: update
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
e.getPresentation().setText(CommonActionsPanel.Buttons.EDIT.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));
}
}
示例11: getChildren
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@Override
@Nonnull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e == null) {
return EMPTY_ARRAY;
}
final Project project = e.getDataContext().getData(CommonDataKeys.PROJECT);
final List<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
availableFavoritesLists.remove(e.getDataContext().getData(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY));
if (availableFavoritesLists.isEmpty()) {
return new AnAction[]{new SendToNewFavoritesListAction()};
}
List<AnAction> actions = new ArrayList<AnAction>();
for (String list : availableFavoritesLists) {
actions.add(new SendToFavoritesAction(list));
}
actions.add(AnSeparator.getInstance());
actions.add(new SendToNewFavoritesListAction());
return actions.toArray(new AnAction[actions.size()]);
}
示例12: getChildren
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@Override
@Nonnull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e == null) return AnAction.EMPTY_ARRAY;
final Project project = e.getProject();
if (project == null) {
return AnAction.EMPTY_ARRAY;
}
final List<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
availableFavoritesLists.remove(e.getDataContext().getData(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY));
if (availableFavoritesLists.isEmpty()) {
return new AnAction[]{new AddToNewFavoritesListAction()};
}
AnAction[] actions = new AnAction[availableFavoritesLists.size() + 2];
int idx = 0;
for (String favoritesList : availableFavoritesLists) {
actions[idx++] = new AddToFavoritesAction(favoritesList);
}
actions[idx++] = AnSeparator.getInstance();
actions[idx] = new AddToNewFavoritesListAction();
return actions;
}
示例13: getChildren
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@Override
@Nonnull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e == null) return AnAction.EMPTY_ARRAY;
final Project project = e.getProject();
if (project == null) {
return AnAction.EMPTY_ARRAY;
}
final List<String> listNames = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
final List<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
availableFavoritesLists.remove(e.getDataContext().getData(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY));
if (availableFavoritesLists.isEmpty()) {
return new AnAction[]{new AddAllOpenFilesToNewFavoritesListAction()};
}
AnAction[] actions = new AnAction[listNames.size() + 2];
int idx = 0;
for (String favoritesList : listNames) {
actions[idx++] = new AddAllOpenFilesToFavorites(favoritesList);
}
actions[idx++] = AnSeparator.getInstance();
actions[idx] = new AddAllOpenFilesToNewFavoritesListAction();
return actions;
}
示例14: actionPerformed
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
Project project = e.getProject();
final FavoritesManager favoritesManager = FavoritesManager.getInstance(project);
FavoritesTreeNodeDescriptor[] roots = dataContext.getData(FavoritesTreeViewPanel.CONTEXT_FAVORITES_ROOTS_DATA_KEY);
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());
}
}
}
示例15: isEnabled
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel; //导入依赖的package包/类
static boolean isEnabled(AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return false;
}
FavoritesTreeNodeDescriptor[] roots = e.getDataContext().getData(FavoritesTreeViewPanel.CONTEXT_FAVORITES_ROOTS_DATA_KEY);
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;
}