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

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

Introduction

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

Prototype

String GROUP_VERSION_CONTROLS

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

Click Source Link

Usage

From source file:com.intellij.codeInspection.ui.InspectionResultsView.java

License:Apache License

private void popupInvoked(Component component, int x, int y) {
    final TreePath path = myTree.getLeadSelectionPath();

    if (path == null)
        return;//from  w w  w  .j  a  v a 2s . c om

    final DefaultActionGroup actions = new DefaultActionGroup();
    final ActionManager actionManager = ActionManager.getInstance();
    actions.add(actionManager.getAction(IdeActions.ACTION_EDIT_SOURCE));
    actions.add(actionManager.getAction(IdeActions.ACTION_FIND_USAGES));

    actions.add(myIncludeAction);
    actions.add(myExcludeAction);

    actions.addSeparator();

    final InspectionToolWrapper toolWrapper = myTree.getSelectedToolWrapper();
    if (toolWrapper != null) {
        final QuickFixAction[] quickFixes = myProvider.getQuickFixes(toolWrapper, myTree);
        if (quickFixes != null) {
            for (QuickFixAction quickFixe : quickFixes) {
                actions.add(quickFixe);
            }
        }
        final HighlightDisplayKey key = HighlightDisplayKey.find(toolWrapper.getShortName());
        if (key == null)
            return; //e.g. DummyEntryPointsTool

        //options
        actions.addSeparator();
        actions.add(new EditSettingsAction());
        final List<AnAction> options = new InspectionsOptionsToolbarAction(this).createActions();
        for (AnAction action : options) {
            actions.add(action);
        }
    }

    actions.addSeparator();
    actions.add(actionManager.getAction(IdeActions.GROUP_VERSION_CONTROLS));

    final ActionPopupMenu menu = actionManager.createActionPopupMenu(ActionPlaces.CODE_INSPECTION, actions);
    menu.getComponent().show(component, x, y);
}

From source file:com.intellij.cyclicDependencies.ui.CyclicDependenciesPanel.java

License:Apache License

private static ActionGroup createTreePopupActions() {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE));
    group.add(ActionManager.getInstance().getAction(IdeActions.GROUP_VERSION_CONTROLS));
    return group;
}

From source file:com.intellij.ide.todo.TodoPanel.java

License:Apache License

private void initUI() {
    UIUtil.setLineStyleAngled(myTree);//from   ww w.j  a v  a2 s .  c  o m
    myTree.setShowsRootHandles(true);
    myTree.setRootVisible(false);
    myTree.setCellRenderer(new TodoCompositeRenderer());
    EditSourceOnDoubleClickHandler.install(myTree);
    new TreeSpeedSearch(myTree);

    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(myTree, group, ActionPlaces.TODO_VIEW_POPUP, ActionManager.getInstance());

    myTree.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (!e.isConsumed() && KeyEvent.VK_ENTER == e.getKeyCode()) {
                TreePath path = myTree.getSelectionPath();
                if (path == null) {
                    return;
                }
                final Object userObject = ((DefaultMutableTreeNode) path.getLastPathComponent())
                        .getUserObject();
                NodeDescriptor desciptor = userObject instanceof NodeDescriptor ? (NodeDescriptor) userObject
                        : null;
                if (!(desciptor instanceof TodoItemNode)) {
                    return;
                }
                OpenSourceUtil.openSourcesFrom(DataManager.getInstance().getDataContext(TodoPanel.this), false);
            }
        }
    });

    myUsagePreviewPanel = new UsagePreviewPanel(myProject, new UsageViewPresentation());
    myUsagePreviewPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
    Disposer.register(this, myUsagePreviewPanel);
    myUsagePreviewPanel.setVisible(mySettings.isShowPreview());

    setContent(createCenterComponent());

    myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(final TreeSelectionEvent e) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    if (myUsagePreviewPanel.isVisible()) {
                        updatePreviewPanel();
                    }
                }
            });
        }
    });

    // Create tool bars and register custom shortcuts

    JPanel toolBarPanel = new JPanel(new GridLayout());

    DefaultActionGroup leftGroup = new DefaultActionGroup();
    leftGroup.add(new PreviousOccurenceToolbarAction(myOccurenceNavigator));
    leftGroup.add(new NextOccurenceToolbarAction(myOccurenceNavigator));
    leftGroup.add(new ContextHelpAction("find.todoList"));
    toolBarPanel.add(ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.TODO_VIEW_TOOLBAR, leftGroup, false).getComponent());

    DefaultActionGroup rightGroup = new DefaultActionGroup();
    AnAction expandAllAction = CommonActionsManager.getInstance().createExpandAllAction(myTreeExpander, this);
    rightGroup.add(expandAllAction);

    AnAction collapseAllAction = CommonActionsManager.getInstance().createCollapseAllAction(myTreeExpander,
            this);
    rightGroup.add(collapseAllAction);

    if (!myCurrentFileMode) {
        MyShowModulesAction showModulesAction = new MyShowModulesAction();
        showModulesAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_M,
                SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK)), myTree);
        rightGroup.add(showModulesAction);
        MyShowPackagesAction showPackagesAction = new MyShowPackagesAction();
        showPackagesAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_P,
                SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK)), myTree);
        rightGroup.add(showPackagesAction);

        MyFlattenPackagesAction flattenPackagesAction = new MyFlattenPackagesAction();
        flattenPackagesAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke
                .getKeyStroke(KeyEvent.VK_F, SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK)),
                myTree);
        rightGroup.add(flattenPackagesAction);
    }

    MyAutoScrollToSourceHandler autoScrollToSourceHandler = new MyAutoScrollToSourceHandler();
    autoScrollToSourceHandler.install(myTree);
    rightGroup.add(autoScrollToSourceHandler.createToggleAction());

    SetTodoFilterAction setTodoFilterAction = new SetTodoFilterAction(myProject, mySettings,
            new Consumer<TodoFilter>() {
                @Override
                public void consume(TodoFilter todoFilter) {
                    setTodoFilter(todoFilter);
                }
            });
    rightGroup.add(setTodoFilterAction);
    rightGroup.add(new MyPreviewAction());
    toolBarPanel.add(ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.TODO_VIEW_TOOLBAR, rightGroup, false).getComponent());

    setToolbar(toolBarPanel);
}

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 {/*  w  w  w  .  ja va2 s . c  o  m*/
        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   w w  w .  j a  v  a2 s .  co 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: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.  ja  v a 2  s . c o 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);
}