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

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

Introduction

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

Prototype

String ACTION_NEXT_OCCURENCE

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

Click Source Link

Usage

From source file:com.intellij.debugger.ui.DebuggerStatementEditor.java

License:Apache License

public DebuggerStatementEditor(Project project, PsiElement context, @NonNls String recentsId,
        final CodeFragmentFactory factory) {
    super(project, context, recentsId, factory);
    myRecentIdx = getRecentItemsCount();
    final Document document = EditorFactory.getInstance().createDocument("");
    myEditor = new EditorTextField(document, project, factory.getFileType(), false, false) {
        protected EditorEx createEditor() {
            EditorEx editor = super.createEditor();
            editor.setVerticalScrollbarVisible(true);
            editor.setHorizontalScrollbarVisible(true);
            return editor;
        }//from w  w  w .  j a  v  a  2  s. c  om
    };

    setLayout(new BorderLayout());
    add(addChooseFactoryLabel(myEditor, true));

    DefaultActionGroup actionGroup = new DefaultActionGroup(null, false);
    actionGroup.add(new ItemAction(IdeActions.ACTION_PREVIOUS_OCCURENCE, this) {
        public void actionPerformed(AnActionEvent e) {
            LOG.assertTrue(myRecentIdx >= 0);
            // since recents are stored in a stack, previous item is at currentIndex + 1
            myRecentIdx += 1;
            updateTextFromRecents();
        }

        public void update(AnActionEvent e) {
            e.getPresentation().setEnabled(myRecentIdx < getRecentItemsCount());
        }
    });
    actionGroup.add(new ItemAction(IdeActions.ACTION_NEXT_OCCURENCE, this) {
        public void actionPerformed(AnActionEvent e) {
            if (LOG.isDebugEnabled()) {
                LOG.assertTrue(myRecentIdx < getRecentItemsCount());
            }
            // since recents are stored in a stack, next item is at currentIndex - 1
            myRecentIdx -= 1;
            updateTextFromRecents();
        }

        public void update(AnActionEvent e) {
            e.getPresentation().setEnabled(myRecentIdx > 0);
        }
    });

    add(ActionManager.getInstance().createActionToolbar(ActionPlaces.COMBO_PAGER, actionGroup, false)
            .getComponent(), BorderLayout.EAST);

    setText(new TextWithImportsImpl(CodeFragmentKind.CODE_BLOCK, ""));
}

From source file:com.intellij.find.editorHeaderActions.NextOccurrenceAction.java

License:Apache License

public NextOccurrenceAction(EditorSearchComponent editorSearchComponent,
        Getter<JTextComponent> editorTextField) {
    super(editorSearchComponent);
    myTextField = editorTextField;// w w  w  .  ja v  a2 s  . c  o m
    copyFrom(ActionManager.getInstance().getAction(IdeActions.ACTION_NEXT_OCCURENCE));
    ArrayList<Shortcut> shortcuts = new ArrayList<Shortcut>();
    ContainerUtil.addAll(shortcuts,
            ActionManager.getInstance().getAction(IdeActions.ACTION_FIND_NEXT).getShortcutSet().getShortcuts());
    if (!editorSearchComponent.getFindModel().isMultiline()) {
        ContainerUtil.addAll(shortcuts, ActionManager.getInstance()
                .getAction(IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN).getShortcutSet().getShortcuts());

        shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), null));
    }

    registerShortcutsForComponent(shortcuts, editorTextField.get());
}

From source file:com.intellij.ide.actions.NextOccurenceToolbarAction.java

License:Apache License

public NextOccurenceToolbarAction(OccurenceNavigator navigator) {
    myNavigator = navigator;
    copyFrom(ActionManager.getInstance().getAction(IdeActions.ACTION_NEXT_OCCURENCE));
}

From source file:com.intellij.xdebugger.impl.evaluate.CodeFragmentInputComponent.java

License:Apache License

public CodeFragmentInputComponent(final @NotNull Project project,
        @NotNull XDebuggerEditorsProvider editorsProvider, final @Nullable XSourcePosition sourcePosition,
        @Nullable XExpression statements, Disposable parentDisposable) {
    super(XDebuggerBundle.message("dialog.title.evaluate.code.fragment"));
    myMultilineEditor = new XDebuggerMultilineEditor(project, editorsProvider, "evaluateCodeFragment",
            sourcePosition, statements != null ? statements : XExpressionImpl.EMPTY_CODE_FRAGMENT);
    myMainPanel = new JPanel(new BorderLayout());
    JPanel editorPanel = new JPanel(new BorderLayout());
    editorPanel.add(myMultilineEditor.getComponent(), BorderLayout.CENTER);
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new HistoryNavigationAction(false, IdeActions.ACTION_PREVIOUS_OCCURENCE, parentDisposable));
    group.add(new HistoryNavigationAction(true, IdeActions.ACTION_NEXT_OCCURENCE, parentDisposable));
    editorPanel.add(//from  w w  w.  j  av a2 s. c  o  m
            ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false).getComponent(),
            BorderLayout.EAST);
    myMainPanel.add(new JLabel(XDebuggerBundle.message("xdebugger.label.text.code.fragment")),
            BorderLayout.NORTH);
    myMainPanel.add(editorPanel, BorderLayout.CENTER);
}