Search in sources :

Example 21 with DefaultActionGroup

use of org.eclipse.che.ide.api.action.DefaultActionGroup in project che by eclipse.

the class MachineExtension method prepareActions.

@Inject
private void prepareActions(MachineLocalizationConstant localizationConstant, ActionManager actionManager, KeyBindingAgent keyBinding, ExecuteSelectedCommandAction executeSelectedCommandAction, SelectCommandComboBox selectCommandAction, EditCommandsAction editCommandsAction, StopWorkspaceAction stopWorkspaceAction, SwitchPerspectiveAction switchPerspectiveAction, RunCommandAction runCommandAction, NewTerminalAction newTerminalAction, EditTargetsAction editTargetsAction, IconRegistry iconRegistry, MachineResources machineResources, ReRunProcessAction reRunProcessAction, StopProcessAction stopProcessAction, CloseConsoleAction closeConsoleAction, ShowConsoleTreeAction showConsoleTreeAction) {
    final DefaultActionGroup workspaceMenu = (DefaultActionGroup) actionManager.getAction(GROUP_WORKSPACE);
    final DefaultActionGroup runMenu = (DefaultActionGroup) actionManager.getAction(GROUP_RUN);
    // register actions
    actionManager.registerAction("editCommands", editCommandsAction);
    actionManager.registerAction("selectCommandAction", selectCommandAction);
    actionManager.registerAction("executeSelectedCommand", executeSelectedCommandAction);
    actionManager.registerAction("editTargets", editTargetsAction);
    actionManager.registerAction("stopWorkspace", stopWorkspaceAction);
    actionManager.registerAction("runCommand", runCommandAction);
    actionManager.registerAction("newTerminal", newTerminalAction);
    // add actions in main menu
    runMenu.add(newTerminalAction, FIRST);
    runMenu.addSeparator();
    runMenu.add(editCommandsAction);
    runMenu.add(editTargetsAction);
    workspaceMenu.add(stopWorkspaceAction);
    if (centralToolbarVisible) {
        // add actions on center part of toolbar
        final DefaultActionGroup centerToolbarGroup = (DefaultActionGroup) actionManager.getAction(GROUP_CENTER_TOOLBAR);
        final DefaultActionGroup machineToolbarGroup = new DefaultActionGroup(GROUP_MACHINE_TOOLBAR, false, actionManager);
        actionManager.registerAction(GROUP_MACHINE_TOOLBAR, machineToolbarGroup);
        centerToolbarGroup.add(machineToolbarGroup, FIRST);
        machineToolbarGroup.add(selectCommandAction);
        final DefaultActionGroup executeToolbarGroup = new DefaultActionGroup(actionManager);
        executeToolbarGroup.add(executeSelectedCommandAction);
        machineToolbarGroup.add(executeToolbarGroup);
    }
    // add group for list of machines
    final DefaultActionGroup machinesList = new DefaultActionGroup(GROUP_MACHINES_DROPDOWN, true, actionManager);
    actionManager.registerAction(GROUP_MACHINES_LIST, machinesList);
    machinesList.add(editTargetsAction, FIRST);
    // add group for list of commands
    final DefaultActionGroup commandList = new DefaultActionGroup(GROUP_COMMANDS_DROPDOWN, true, actionManager);
    actionManager.registerAction(GROUP_COMMANDS_LIST, commandList);
    commandList.add(editCommandsAction, FIRST);
    // Consoles tree context menu group
    DefaultActionGroup consolesTreeContextMenu = (DefaultActionGroup) actionManager.getAction(GROUP_CONSOLES_TREE_CONTEXT_MENU);
    consolesTreeContextMenu.add(reRunProcessAction);
    consolesTreeContextMenu.add(stopProcessAction);
    consolesTreeContextMenu.add(closeConsoleAction);
    DefaultActionGroup partMenuGroup = (DefaultActionGroup) actionManager.getAction(IdeActions.GROUP_PART_MENU);
    partMenuGroup.add(showConsoleTreeAction);
    // Define hot-keys
    keyBinding.getGlobal().addKey(new KeyBuilder().alt().charCode(KeyCodeMap.F12).build(), "newTerminal");
    iconRegistry.registerIcon(new Icon("che.machine.icon", machineResources.devMachine()));
}
Also used : KeyBuilder(org.eclipse.che.ide.api.keybinding.KeyBuilder) Icon(org.eclipse.che.ide.api.icon.Icon) DefaultActionGroup(org.eclipse.che.ide.api.action.DefaultActionGroup) Inject(com.google.inject.Inject)

Example 22 with DefaultActionGroup

use of org.eclipse.che.ide.api.action.DefaultActionGroup in project che by eclipse.

the class PhpExtension method prepareActions.

@Inject
private void prepareActions(CreatePhpSourceFileAction phpSourceFileAction, ActionManager actionManager, PhpResources resources, IconRegistry iconRegistry) {
    DefaultActionGroup newGroup = (DefaultActionGroup) actionManager.getAction(GROUP_FILE_NEW);
    actionManager.registerAction("newPhpFile", phpSourceFileAction);
    newGroup.add(phpSourceFileAction, Constraints.FIRST);
    iconRegistry.registerIcon(new Icon(PHP_CATEGORY + ".samples.category.icon", resources.category()));
}
Also used : Icon(org.eclipse.che.ide.api.icon.Icon) DefaultActionGroup(org.eclipse.che.ide.api.action.DefaultActionGroup) Inject(com.google.inject.Inject)

Example 23 with DefaultActionGroup

use of org.eclipse.che.ide.api.action.DefaultActionGroup in project che by eclipse.

the class NativeAccessExampleExtension method configureActions.

@Inject
private void configureActions(final ActionManager actionManager, final RunNativeCommandAction runNativenCommandAction) {
    DefaultActionGroup mainContextMenuGroup = (DefaultActionGroup) actionManager.getAction("resourceOperation");
    DefaultActionGroup naGroup = new DefaultActionGroup("Native Access Example", true, actionManager);
    mainContextMenuGroup.add(naGroup);
    actionManager.registerAction(runNativenCommandAction.ACTION_ID, runNativenCommandAction);
    naGroup.addAction(runNativenCommandAction);
}
Also used : DefaultActionGroup(org.eclipse.che.ide.api.action.DefaultActionGroup) Inject(com.google.inject.Inject)

Example 24 with DefaultActionGroup

use of org.eclipse.che.ide.api.action.DefaultActionGroup in project che by eclipse.

the class SampleWizardExtension method prepareActions.

@Inject
private void prepareActions(SampleAction sampleAction, NewXFileAction newXFileAction, ActionManager actionManager) {
    DefaultActionGroup newGroup = (DefaultActionGroup) actionManager.getAction(GROUP_HELP);
    DefaultActionGroup newFileGroup = (DefaultActionGroup) actionManager.getAction(GROUP_FILE_NEW);
    actionManager.registerAction("sayHello", sampleAction);
    actionManager.registerAction("newFileActon", newXFileAction);
    newGroup.add(sampleAction, Constraints.FIRST);
    newFileGroup.add(newXFileAction, Constraints.FIRST);
}
Also used : DefaultActionGroup(org.eclipse.che.ide.api.action.DefaultActionGroup) Inject(com.google.inject.Inject)

Example 25 with DefaultActionGroup

use of org.eclipse.che.ide.api.action.DefaultActionGroup in project che by eclipse.

the class HelloWorldViewExampleExtension method configureActions.

@Inject
private void configureActions(final ActionManager actionManager, final HelloWorldAction helloWorldAction) {
    DefaultActionGroup mainContextMenuGroup = (DefaultActionGroup) actionManager.getAction("resourceOperation");
    DefaultActionGroup jsGroup = new DefaultActionGroup("JavaScript View Example", true, actionManager);
    mainContextMenuGroup.add(jsGroup);
    actionManager.registerAction(helloWorldAction.ACTION_ID, helloWorldAction);
    jsGroup.addAction(helloWorldAction);
}
Also used : DefaultActionGroup(org.eclipse.che.ide.api.action.DefaultActionGroup) Inject(com.google.inject.Inject)

Aggregations

DefaultActionGroup (org.eclipse.che.ide.api.action.DefaultActionGroup)26 Inject (com.google.inject.Inject)14 Action (org.eclipse.che.ide.api.action.Action)8 Icon (org.eclipse.che.ide.api.icon.Icon)5 KeyBuilder (org.eclipse.che.ide.api.keybinding.KeyBuilder)4 Machine (org.eclipse.che.api.core.model.machine.Machine)2 Constraints (org.eclipse.che.ide.api.constraints.Constraints)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 MachineConfig (org.eclipse.che.api.core.model.machine.MachineConfig)1 CloseActiveEditorAction (org.eclipse.che.ide.actions.CloseActiveEditorAction)1 CollapseAllAction (org.eclipse.che.ide.actions.CollapseAllAction)1 CompleteAction (org.eclipse.che.ide.actions.CompleteAction)1 ConvertFolderToProjectAction (org.eclipse.che.ide.actions.ConvertFolderToProjectAction)1 CreateProjectAction (org.eclipse.che.ide.actions.CreateProjectAction)1 DeleteResourceAction (org.eclipse.che.ide.actions.DeleteResourceAction)1 DownloadProjectAction (org.eclipse.che.ide.actions.DownloadProjectAction)1 DownloadResourceAction (org.eclipse.che.ide.actions.DownloadResourceAction)1