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

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

Introduction

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

Prototype

String GROUP_CONSOLE_EDITOR_POPUP

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

Click Source Link

Usage

From source file:cn.fishy.plugin.idea.ponytail.Console.java

License:Apache License

private DefaultActionGroup createPopupActions(ActionManager actionManager, ClearLogAction action) {
    AnAction[] children = ((ActionGroup) actionManager.getAction(IdeActions.GROUP_CONSOLE_EDITOR_POPUP))
            .getChildren(null);/*from   w  ww  .j a  v a  2  s  .c  om*/
    DefaultActionGroup group = new DefaultActionGroup(children);
    group.addSeparator();
    group.add(action);
    return group;
}

From source file:com.intellij.execution.console.LanguageConsoleImpl.java

License:Apache License

private void setupComponents() {
    setupEditorDefault(myConsoleEditor);
    setupEditorDefault(myHistoryViewer);

    //noinspection ConstantConditions
    if (SEPARATOR_THICKNESS > 0 && myShowSeparatorLine) {
        myHistoryViewer.getComponent().setBorder(new SideBorder(JBColor.LIGHT_GRAY, SideBorder.BOTTOM));
    }//from  ww w .java 2  s . c o m
    myHistoryViewer.getComponent().setMinimumSize(new Dimension(0, 0));
    myHistoryViewer.getComponent().setPreferredSize(new Dimension(0, 0));
    myHistoryViewer.setCaretEnabled(false);

    myConsoleEditor.setHorizontalScrollbarVisible(true);
    myConsoleEditor.addEditorMouseListener(
            EditorActionUtil.createEditorPopupHandler(IdeActions.GROUP_CONSOLE_EDITOR_POPUP));
    myConsoleEditor.setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(myVirtualFile,
            myConsoleEditor.getColorsScheme(), myProject));

    myConsoleEditor.getScrollingModel().addVisibleAreaListener(new VisibleAreaListener() {
        @Override
        public void visibleAreaChanged(VisibleAreaEvent e) {
            final int offset = myConsoleEditor.getScrollingModel().getHorizontalScrollOffset();
            final ScrollingModel model = myHistoryViewer.getScrollingModel();
            final int historyOffset = model.getHorizontalScrollOffset();
            if (historyOffset != offset) {
                try {
                    model.disableAnimation();
                    model.scrollHorizontally(offset);
                } finally {
                    model.enableAnimation();
                }
            }
        }
    });
    final DocumentAdapter docListener = new DocumentAdapter() {
        @Override
        public void documentChanged(final DocumentEvent e) {
            queueUiUpdate(false);
        }
    };
    myEditorDocument.addDocumentListener(docListener, this);
    myHistoryViewer.getDocument().addDocumentListener(docListener, this);

    myHistoryViewer.getContentComponent().addKeyListener(new KeyAdapter() {
        @Override
        public void keyTyped(KeyEvent event) {
            if (isConsoleEditorEnabled() && UIUtil.isReallyTypedEvent(event)) {
                myConsoleEditor.getContentComponent().requestFocus();
                myConsoleEditor.processKeyTyped(event);
            }
        }
    });

    //noinspection deprecation
    for (AnAction action : createActions()) {
        action.registerCustomShortcutSet(action.getShortcutSet(), myConsoleEditor.getComponent());
    }
    EmptyAction.registerActionShortcuts(myHistoryViewer.getComponent(), myConsoleEditor.getComponent());
}

From source file:javarepl.plugin.JavaREPLLanguageConsole.java

License:Apache License

private void setupComponents() {
    setupEditorDefault(myConsoleEditor);
    setupEditorDefault(myHistoryViewer);
    myConsoleEditor.addEditorMouseListener(
            EditorActionUtil.createEditorPopupHandler(IdeActions.GROUP_CONSOLE_EDITOR_POPUP));
    //noinspection PointlessBooleanExpression,ConstantConditions
    if (SEPARATOR_THICKNESS > 0 && myShowSeparatorLine) {
        myHistoryViewer.getComponent().setBorder(new SideBorder(Color.LIGHT_GRAY, SideBorder.BOTTOM));
    }/*  w  w w .  ja  v a 2  s.c  om*/
    myHistoryViewer.getComponent().setMinimumSize(new Dimension(0, 0));
    myHistoryViewer.getComponent().setPreferredSize(new Dimension(0, 0));
    myConsoleEditor.getSettings().setAdditionalLinesCount(2);
    myConsoleEditor.setHighlighter(
            EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, myVirtualFile));
    myHistoryViewer.setCaretEnabled(false);
    myConsoleEditor.setHorizontalScrollbarVisible(true);
    final VisibleAreaListener areaListener = new VisibleAreaListener() {
        public void visibleAreaChanged(VisibleAreaEvent e) {
            final int offset = myConsoleEditor.getScrollingModel().getHorizontalScrollOffset();
            final ScrollingModel model = myHistoryViewer.getScrollingModel();
            final int historyOffset = model.getHorizontalScrollOffset();
            if (historyOffset != offset) {
                try {
                    model.disableAnimation();
                    model.scrollHorizontally(offset);
                } finally {
                    model.enableAnimation();
                }
            }
        }
    };
    myConsoleEditor.getScrollingModel().addVisibleAreaListener(areaListener);
    final DocumentAdapter docListener = new DocumentAdapter() {
        @Override
        public void documentChanged(final DocumentEvent e) {
            updateCodeCompletion();
            queueUiUpdate(false);
        }
    };
    myEditorDocument.addDocumentListener(docListener, this);
    myHistoryViewer.getDocument().addDocumentListener(docListener, this);

    myHistoryViewer.getContentComponent().addKeyListener(new KeyAdapter() {
        public void keyTyped(KeyEvent event) {
            if (isConsoleEditorEnabled() && UIUtil.isReallyTypedEvent(event)) {
                myConsoleEditor.getContentComponent().requestFocus();
                myConsoleEditor.processKeyTyped(event);
            }
        }
    });
    for (AnAction action : createActions()) {
        action.registerCustomShortcutSet(action.getShortcutSet(), myConsoleEditor.getComponent());
    }
    EmptyAction.registerActionShortcuts(myHistoryViewer.getComponent(), myConsoleEditor.getComponent());
}