Search in sources :

Example 1 with NextOccurenceToolbarAction

use of com.intellij.ide.actions.NextOccurenceToolbarAction in project intellij-community by JetBrains.

the class AntBuildMessageView method createToolbarPanel.

private JPanel createToolbarPanel() {
    RunAction runAction = new RunAction(this);
    runAction.registerCustomShortcutSet(CommonShortcuts.getRerun(), this);
    DefaultActionGroup leftActionGroup = new DefaultActionGroup();
    leftActionGroup.add(runAction);
    leftActionGroup.add(new PauseOutputAction(this));
    leftActionGroup.add(new StopAction(this));
    leftActionGroup.add(new CloseAction());
    leftActionGroup.add(new PreviousOccurenceToolbarAction(this));
    leftActionGroup.add(new NextOccurenceToolbarAction(this));
    leftActionGroup.add(new ContextHelpAction(HelpID.ANT));
    DefaultActionGroup rightActionGroup = new DefaultActionGroup();
    rightActionGroup.add(new ChangeViewAction(this));
    rightActionGroup.add(new VerboseAction(this));
    rightActionGroup.add(CommonActionsManager.getInstance().createExpandAllAction(myTreeExpander, this));
    rightActionGroup.add(CommonActionsManager.getInstance().createCollapseAllAction(myTreeExpander, this));
    rightActionGroup.add(myTreeView.createToggleAutoscrollAction());
    myLeftToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.ANT_MESSAGES_TOOLBAR, leftActionGroup, false);
    JPanel toolbarPanel = new JPanel(new GridLayout(1, 2, 2, 0));
    toolbarPanel.add(myLeftToolbar.getComponent());
    myRightToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.ANT_MESSAGES_TOOLBAR, rightActionGroup, false);
    toolbarPanel.add(myRightToolbar.getComponent());
    return toolbarPanel;
}
Also used : NextOccurenceToolbarAction(com.intellij.ide.actions.NextOccurenceToolbarAction) ContextHelpAction(com.intellij.ide.actions.ContextHelpAction) PreviousOccurenceToolbarAction(com.intellij.ide.actions.PreviousOccurenceToolbarAction)

Example 2 with NextOccurenceToolbarAction

use of com.intellij.ide.actions.NextOccurenceToolbarAction in project intellij-community by JetBrains.

the class TodoPanel method initUI.

private void initUI() {
    UIUtil.setLineStyleAngled(myTree);
    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();
                if (!((userObject instanceof NodeDescriptor ? (NodeDescriptor) userObject : null) instanceof TodoItemNode)) {
                    return;
                }
                OpenSourceUtil.openSourcesFrom(DataManager.getInstance().getDataContext(TodoPanel.this), false);
            }
        }
    });
    myUsagePreviewPanel = new UsagePreviewPanel(myProject, FindInProjectUtil.setupViewPresentation(false, new FindModel()));
    Disposer.register(this, myUsagePreviewPanel);
    myUsagePreviewPanel.setVisible(mySettings.showPreview);
    setContent(createCenterComponent());
    myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(final TreeSelectionEvent e) {
            ApplicationManager.getApplication().invokeLater(() -> {
                if (myUsagePreviewPanel.isVisible()) {
                    updatePreviewPanel();
                }
            }, ModalityState.NON_MODAL, myProject.getDisposed());
        }
    });
    // 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, todoFilter -> setTodoFilter(todoFilter));
    rightGroup.add(setTodoFilterAction);
    rightGroup.add(new MyPreviewAction());
    toolBarPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.TODO_VIEW_TOOLBAR, rightGroup, false).getComponent());
    setToolbar(toolBarPanel);
}
Also used : FindModel(com.intellij.find.FindModel) KeyAdapter(java.awt.event.KeyAdapter) NodeDescriptor(com.intellij.ide.util.treeView.NodeDescriptor) UsagePreviewPanel(com.intellij.usages.impl.UsagePreviewPanel) TreeSelectionListener(javax.swing.event.TreeSelectionListener) ContextHelpAction(com.intellij.ide.actions.ContextHelpAction) PreviousOccurenceToolbarAction(com.intellij.ide.actions.PreviousOccurenceToolbarAction) KeyEvent(java.awt.event.KeyEvent) NextOccurenceToolbarAction(com.intellij.ide.actions.NextOccurenceToolbarAction) TodoItemNode(com.intellij.ide.todo.nodes.TodoItemNode) TreePath(javax.swing.tree.TreePath) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent)

Aggregations

ContextHelpAction (com.intellij.ide.actions.ContextHelpAction)2 NextOccurenceToolbarAction (com.intellij.ide.actions.NextOccurenceToolbarAction)2 PreviousOccurenceToolbarAction (com.intellij.ide.actions.PreviousOccurenceToolbarAction)2 FindModel (com.intellij.find.FindModel)1 TodoItemNode (com.intellij.ide.todo.nodes.TodoItemNode)1 NodeDescriptor (com.intellij.ide.util.treeView.NodeDescriptor)1 UsagePreviewPanel (com.intellij.usages.impl.UsagePreviewPanel)1 KeyAdapter (java.awt.event.KeyAdapter)1 KeyEvent (java.awt.event.KeyEvent)1 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)1 TreeSelectionListener (javax.swing.event.TreeSelectionListener)1 TreePath (javax.swing.tree.TreePath)1