Example usage for com.intellij.openapi.actionSystem IdeActions ACTION_EDIT_SOURCE

List of usage examples for com.intellij.openapi.actionSystem IdeActions ACTION_EDIT_SOURCE

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem IdeActions ACTION_EDIT_SOURCE.

Prototype

String ACTION_EDIT_SOURCE

To view the source code for com.intellij.openapi.actionSystem IdeActions ACTION_EDIT_SOURCE.

Click Source Link

Usage

From source file:com.intellij.lang.ant.config.explorer.AntExplorer.java

License:Apache License

private void popupInvoked(final Component comp, final int x, final int y) {
    Object userObject = null;//w ww.j a v a  2 s.  co m
    final TreePath path = myTree.getSelectionPath();
    if (path != null) {
        final DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
        if (node != null) {
            userObject = node.getUserObject();
        }
    }
    final DefaultActionGroup group = new DefaultActionGroup();
    group.add(new RunAction());
    group.add(new CreateMetaTargetAction());
    group.add(new RemoveMetaTargetsOrBuildFileAction());
    group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE));
    group.add(new AntGroupManagerActionGroup(null, myTree));
    group.add(new RemoveGroupsAction(myTree));
    if (userObject instanceof AntBuildFileNodeDescriptor) {
        group.add(new RemoveBuildFileAction(this));
    }
    if (userObject instanceof AntTargetNodeDescriptor) {
        final AntBuildTargetBase target = ((AntTargetNodeDescriptor) userObject).getTarget();
        final DefaultActionGroup executeOnGroup = new DefaultActionGroup(
                AntBundle.message("ant.explorer.execute.on.action.group.name"), true);
        executeOnGroup.add(new ExecuteOnEventAction(target, ExecuteBeforeCompilationEvent.getInstance()));
        executeOnGroup.add(new ExecuteOnEventAction(target, ExecuteAfterCompilationEvent.getInstance()));
        executeOnGroup.addSeparator();
        executeOnGroup.add(new ExecuteBeforeRunAction(target));
        group.add(executeOnGroup);
        group.add(new AssignShortcutAction(target.getActionId()));
    }
    group.add(myAntBuildFilePropertiesAction);
    final ActionPopupMenu popupMenu = ActionManager.getInstance()
            .createActionPopupMenu(ActionPlaces.ANT_EXPLORER_POPUP, group);
    popupMenu.getComponent().show(comp, x, y);
}

From source file:com.intellij.moduleDependencies.ModulesDependenciesPanel.java

License:Apache License

private static ActionGroup createTreePopupActions(final boolean isRightTree, final Tree tree) {
    DefaultActionGroup group = new DefaultActionGroup();
    final TreeExpander treeExpander = new TreeExpander() {
        @Override//  w  w  w.java  2  s  .  c  o m
        public void expandAll() {
            TreeUtil.expandAll(tree);
        }

        @Override
        public boolean canExpand() {
            return isRightTree;
        }

        @Override
        public void collapseAll() {
            TreeUtil.collapseAll(tree, 3);
        }

        @Override
        public boolean canCollapse() {
            return true;
        }
    };

    final CommonActionsManager actionManager = CommonActionsManager.getInstance();
    if (isRightTree) {
        group.add(actionManager.createExpandAllAction(treeExpander, tree));
    }
    group.add(actionManager.createCollapseAllAction(treeExpander, tree));
    final ActionManager globalActionManager = ActionManager.getInstance();
    group.add(globalActionManager.getAction(IdeActions.ACTION_EDIT_SOURCE));
    group.add(AnSeparator.getInstance());
    group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_DEPENDENCIES));
    group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_BACK_DEPENDENCIES));
    //non exists in platform group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_CYCLIC_DEPENDENCIES));
    return group;
}

From source file:com.intellij.packageDependencies.ui.DependenciesPanel.java

License:Apache License

private ActionGroup createTreePopupActions(boolean isRightTree) {
    DefaultActionGroup group = new DefaultActionGroup();
    final ActionManager actionManager = ActionManager.getInstance();
    group.add(actionManager.getAction(IdeActions.ACTION_EDIT_SOURCE));
    group.add(actionManager.getAction(IdeActions.GROUP_VERSION_CONTROLS));

    if (isRightTree) {
        group.add(actionManager.getAction(IdeActions.GROUP_ANALYZE));
        group.add(new AddToScopeAction());
        group.add(new SelectInLeftTreeAction());
        group.add(new ShowDetailedInformationAction());
    } else {/*from  w  w  w  .java  2 s  .  c  om*/
        group.add(new RemoveFromScopeAction());
    }

    return group;
}

From source file:com.intellij.refactoring.typeMigration.ui.MigrationPanel.java

License:Apache License

private ActionGroup createTreePopupActions() {
    final DefaultActionGroup group = new DefaultActionGroup();
    //group.add(new PerformRefactoringAction());
    group.add(new ExcludeAction());
    group.add(new IncludeAction());
    group.addSeparator();//from   ww  w.  j a v a  2  s .c o m
    final ActionManager actionManager = ActionManager.getInstance();
    group.add(actionManager.getAction(IdeActions.ACTION_EDIT_SOURCE));
    group.add(actionManager.getAction(IdeActions.GROUP_VERSION_CONTROLS));
    return group;
}

From source file:com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsDialog.java

License:Apache License

private JComponent createMasterView() {
    myTreeController = new BreakpointItemsTreeController(myRulesEnabled) {
        @Override/*w  ww  .  j  a v a  2  s. c  o m*/
        public void nodeStateWillChangeImpl(CheckedTreeNode node) {
            if (node instanceof BreakpointItemNode) {
                ((BreakpointItemNode) node).getBreakpointItem().saveState();
            }
            super.nodeStateWillChangeImpl(node);
        }

        @Override
        public void nodeStateDidChangeImpl(CheckedTreeNode node) {
            super.nodeStateDidChangeImpl(node);
            if (node instanceof BreakpointItemNode) {
                myDetailController.doUpdateDetailView(true);
            }
        }

        @Override
        protected void selectionChangedImpl() {
            super.selectionChangedImpl();
            saveCurrentItem();
            myDetailController.updateDetailView();
        }
    };
    final JTree tree = new BreakpointsCheckboxTree(myProject, myTreeController) {
        @Override
        protected void onDoubleClick(CheckedTreeNode node) {
            navigate(false);
        }
    };

    PopupHandler.installPopupHandler(tree, new ActionGroup() {
        @NotNull
        @Override
        public AnAction[] getChildren(@Nullable AnActionEvent e) {
            ActionGroup group = new ActionGroup("Move to group", true) {
                @NotNull
                @Override
                public AnAction[] getChildren(@Nullable AnActionEvent e) {
                    Set<String> groups = getBreakpointManager().getAllGroups();
                    AnAction[] res = new AnAction[groups.size() + 3];
                    int i = 0;
                    res[i++] = new MoveToGroupAction(null);
                    for (String group : groups) {
                        res[i++] = new MoveToGroupAction(group);
                    }
                    res[i++] = new AnSeparator();
                    res[i] = new MoveToGroupAction();
                    return res;
                }
            };
            return new AnAction[] { group };
        }
    }, ActionPlaces.UNKNOWN, ActionManager.getInstance());

    new AnAction("BreakpointDialog.GoToSource") {
        @Override
        public void actionPerformed(AnActionEvent e) {
            navigate(true);
            close(OK_EXIT_CODE);
        }
    }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)), tree);

    new AnAction("BreakpointDialog.ShowSource") {
        @Override
        public void actionPerformed(AnActionEvent e) {
            navigate(true);
            close(OK_EXIT_CODE);
        }
    }.registerCustomShortcutSet(
            ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE).getShortcutSet(), tree);

    final DefaultActionGroup breakpointTypes = new DefaultActionGroup();
    for (XBreakpointType<?, ?> type : XBreakpointUtil.getBreakpointTypes()) {
        if (type.isAddBreakpointButtonVisible()) {
            breakpointTypes.addAll(new AddXBreakpointAction(type));
        }
    }

    ToolbarDecorator decorator = ToolbarDecorator.createDecorator(tree)
            .setAddAction(new AnActionButtonRunnable() {
                @Override
                public void run(AnActionButton button) {
                    JBPopupFactory.getInstance()
                            .createActionGroupPopup(null, breakpointTypes,
                                    DataManager.getInstance().getDataContext(button.getContextComponent()),
                                    JBPopupFactory.ActionSelectionAid.NUMBERING, false)
                            .show(button.getPreferredPopupPoint());
                }
            }).setRemoveAction(new AnActionButtonRunnable() {
                @Override
                public void run(AnActionButton button) {
                    myTreeController.removeSelectedBreakpoints(myProject);
                }
            }).setRemoveActionUpdater(new AnActionButtonUpdater() {
                @Override
                public boolean isEnabled(AnActionEvent e) {
                    boolean enabled = false;
                    final ItemWrapper[] items = myMasterController.getSelectedItems();
                    for (ItemWrapper item : items) {
                        if (item.allowedToRemove()) {
                            enabled = true;
                        }
                    }
                    return enabled;
                }
            }).setToolbarPosition(ActionToolbarPosition.TOP)
            .setToolbarBorder(IdeBorderFactory.createEmptyBorder());

    tree.setBorder(IdeBorderFactory.createBorder());

    for (ToggleActionButton action : myToggleRuleActions) {
        decorator.addExtraAction(action);
    }

    JPanel decoratedTree = decorator.createPanel();
    decoratedTree.setBorder(IdeBorderFactory.createEmptyBorder());

    myTreeController.setTreeView(tree);

    myTreeController.buildTree(myBreakpointItems);

    initSelection(myBreakpointItems);

    final BreakpointPanelProvider.BreakpointsListener listener = new BreakpointPanelProvider.BreakpointsListener() {
        @Override
        public void breakpointsChanged() {
            collectItems();
            myTreeController.rebuildTree(myBreakpointItems);
            myDetailController.doUpdateDetailView(true);
        }
    };

    for (BreakpointPanelProvider provider : myBreakpointsPanelProviders) {
        provider.addListener(listener, myProject, myListenerDisposable);
    }

    return decoratedTree;
}

From source file:com.jetbrains.lang.dart.ide.errorTreeView.DartProblemsViewPanel.java

License:Apache License

private void popupInvoked(final Component component, final int x, final int y) {
    final DefaultActionGroup group = new DefaultActionGroup();
    if (getData(CommonDataKeys.NAVIGATABLE.getName()) != null) {
        group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE));
    }/*from www.  j av  a2  s . c o m*/

    group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_COPY));

    final ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.TOOLBAR, group);
    menu.getComponent().show(component, x, y);
}

From source file:org.intellij.plugins.xsltDebugger.ui.actions.NavigateAction.java

License:Apache License

public static AnAction getInstance() {
    return ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE);
}

From source file:org.napile.idea.thermit.config.execution.TreeView.java

License:Apache License

private void popupInvoked(Component component, int x, int y) {
    final TreePath path = myTree.getLeadSelectionPath();
    if (path == null)
        return;//w  w  w  .  j  a  v a  2s .  c  om
    if (!(path.getLastPathComponent() instanceof MessageNode))
        return;
    if (getData(PlatformDataKeys.NAVIGATABLE_ARRAY.getName()) == null)
        return;
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE));
    ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.ANT_MESSAGES_POPUP,
            group);
    menu.getComponent().show(component, x, y);
}

From source file:org.napile.idea.thermit.config.explorer.AntExplorer.java

License:Apache License

private void popupInvoked(final Component comp, final int x, final int y) {
    Object userObject = null;/* w ww  . ja  v  a  2s  .c o  m*/
    final TreePath path = myTree.getSelectionPath();
    if (path != null) {
        final DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
        if (node != null) {
            userObject = node.getUserObject();
        }
    }
    final DefaultActionGroup group = new DefaultActionGroup();
    group.add(new RunAction());
    group.add(new CreateMetaTargetAction());
    group.add(new RemoveMetaTargetsOrBuildFileAction());
    group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE));
    if (userObject instanceof AntBuildFileNodeDescriptor) {
        group.add(new RemoveBuildFileAction(this));
    }
    if (userObject instanceof AntTargetNodeDescriptor) {
        final AntBuildTargetBase target = ((AntTargetNodeDescriptor) userObject).getTarget();
        final DefaultActionGroup executeOnGroup = new DefaultActionGroup(
                ThermitBundle.message("ant.explorer.execute.on.action.group.name"), true);
        executeOnGroup.add(new ExecuteOnEventAction(target, ExecuteBeforeCompilationEvent.getInstance()));
        executeOnGroup.add(new ExecuteOnEventAction(target, ExecuteAfterCompilationEvent.getInstance()));
        executeOnGroup.addSeparator();
        executeOnGroup.add(new ExecuteBeforeRunAction(target));
        group.add(executeOnGroup);
        group.add(new AssignShortcutAction(target.getActionId()));
    }
    group.add(myAntBuildFilePropertiesAction);
    final ActionPopupMenu popupMenu = ActionManager.getInstance()
            .createActionPopupMenu(ActionPlaces.ANT_EXPLORER_POPUP, group);
    popupMenu.getComponent().show(comp, x, y);
}

From source file:org.sonarlint.intellij.ui.SonarLintIssuesPanel.java

License:Open Source License

private void createTree() {
    treeBuilder = new TreeModelBuilder();
    DefaultTreeModel model = treeBuilder.createModel();
    tree = new IssueTree(project, model);
    UIUtil.setLineStyleAngled(tree);//from  w  w  w  .j a  v a  2 s . co  m
    tree.setShowsRootHandles(true);
    tree.setRootVisible(true);
    tree.setCellRenderer(new IssueTreeCellRenderer());
    tree.expandRow(0);
    tree.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent e) {
            issueTreeSelectionChanged();
        }
    });

    DefaultActionGroup group = new DefaultActionGroup();
    group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE));
    group.addSeparator();
    group.add(ActionManager.getInstance().getAction(IdeActions.GROUP_VERSION_CONTROLS));
    PopupHandler.installPopupHandler(tree, group, ActionPlaces.TODO_VIEW_POPUP, ActionManager.getInstance());

    EditSourceOnDoubleClickHandler.install(tree);
    EditSourceOnEnterKeyHandler.install(tree);
}