Search in sources :

Example 1 with GrSelectModuleAction

use of org.jetbrains.plugins.groovy.console.actions.GrSelectModuleAction in project intellij-community by JetBrains.

the class GroovyConsoleRootType method fileOpened.

@Override
public void fileOpened(@NotNull final VirtualFile file, @NotNull FileEditorManager source) {
    final Project project = source.getProject();
    final GroovyConsoleStateService projectConsole = GroovyConsoleStateService.getInstance(project);
    for (FileEditor fileEditor : source.getAllEditors(file)) {
        if (!(fileEditor instanceof TextEditor))
            continue;
        final Editor editor = ((TextEditor) fileEditor).getEditor();
        final JPanel panel = new EditorHeaderComponent();
        final DefaultActionGroup actionGroup = new DefaultActionGroup(EXECUTE_ACTION, new GrSelectModuleAction(projectConsole, file));
        final ActionToolbar menu = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, true);
        panel.add(menu.getComponent());
        editor.setHeaderComponent(panel);
        EXECUTE_ACTION.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, editor.getComponent());
    }
}
Also used : GrSelectModuleAction(org.jetbrains.plugins.groovy.console.actions.GrSelectModuleAction) Project(com.intellij.openapi.project.Project) FileEditor(com.intellij.openapi.fileEditor.FileEditor) TextEditor(com.intellij.openapi.fileEditor.TextEditor) EditorHeaderComponent(com.intellij.openapi.editor.impl.EditorHeaderComponent) Editor(com.intellij.openapi.editor.Editor) FileEditor(com.intellij.openapi.fileEditor.FileEditor) TextEditor(com.intellij.openapi.fileEditor.TextEditor)

Aggregations

Editor (com.intellij.openapi.editor.Editor)1 EditorHeaderComponent (com.intellij.openapi.editor.impl.EditorHeaderComponent)1 FileEditor (com.intellij.openapi.fileEditor.FileEditor)1 TextEditor (com.intellij.openapi.fileEditor.TextEditor)1 Project (com.intellij.openapi.project.Project)1 GrSelectModuleAction (org.jetbrains.plugins.groovy.console.actions.GrSelectModuleAction)1