Search in sources :

Example 1 with PinEditorTabAction

use of org.eclipse.che.ide.part.editor.actions.PinEditorTabAction in project che by eclipse.

the class StandardComponentInitializer method initialize.

public void initialize() {
    messageLoaderResources.Css().ensureInjected();
    editorResources.editorCss().ensureInjected();
    popupResources.popupStyle().ensureInjected();
    fileTypeRegistry.registerFileType(xmlFile);
    fileTypeRegistry.registerFileType(txtFile);
    fileTypeRegistry.registerFileType(jsonFile);
    fileTypeRegistry.registerFileType(mdFile);
    fileTypeRegistry.registerFileType(pngFile);
    editorRegistry.registerDefaultEditor(pngFile, imageViewerProvider);
    fileTypeRegistry.registerFileType(bmpFile);
    editorRegistry.registerDefaultEditor(bmpFile, imageViewerProvider);
    fileTypeRegistry.registerFileType(gifFile);
    editorRegistry.registerDefaultEditor(gifFile, imageViewerProvider);
    fileTypeRegistry.registerFileType(iconFile);
    editorRegistry.registerDefaultEditor(iconFile, imageViewerProvider);
    fileTypeRegistry.registerFileType(svgFile);
    editorRegistry.registerDefaultEditor(svgFile, imageViewerProvider);
    fileTypeRegistry.registerFileType(jpeFile);
    editorRegistry.registerDefaultEditor(jpeFile, imageViewerProvider);
    fileTypeRegistry.registerFileType(jpegFile);
    editorRegistry.registerDefaultEditor(jpegFile, imageViewerProvider);
    fileTypeRegistry.registerFileType(jpgFile);
    editorRegistry.registerDefaultEditor(jpgFile, imageViewerProvider);
    // Workspace (New Menu)
    DefaultActionGroup workspaceGroup = (DefaultActionGroup) actionManager.getAction(GROUP_WORKSPACE);
    actionManager.registerAction(IMPORT_PROJECT, importProjectAction);
    workspaceGroup.add(importProjectAction);
    actionManager.registerAction(CREATE_PROJECT, createProjectAction);
    workspaceGroup.add(createProjectAction);
    actionManager.registerAction("downloadWsAsZipAction", downloadWsAction);
    workspaceGroup.add(downloadWsAction);
    workspaceGroup.addSeparator();
    // Project (New Menu)
    DefaultActionGroup projectGroup = (DefaultActionGroup) actionManager.getAction(GROUP_PROJECT);
    DefaultActionGroup newGroup = new DefaultActionGroup("New", true, actionManager);
    newGroup.getTemplatePresentation().setDescription("Create...");
    newGroup.getTemplatePresentation().setSVGResource(resources.newResource());
    actionManager.registerAction(GROUP_FILE_NEW, newGroup);
    projectGroup.add(newGroup);
    newGroup.addSeparator();
    actionManager.registerAction(NEW_FILE, newFileAction);
    newGroup.addAction(newFileAction);
    actionManager.registerAction("newFolder", newFolderAction);
    newGroup.addAction(newFolderAction);
    newGroup.addSeparator();
    actionManager.registerAction("newXmlFile", newXmlFileAction);
    newXmlFileAction.getTemplatePresentation().setSVGResource(xmlFile.getImage());
    newGroup.addAction(newXmlFileAction);
    actionManager.registerAction("uploadFile", uploadFileAction);
    projectGroup.add(uploadFileAction);
    actionManager.registerAction("uploadFolder", uploadFolderAction);
    projectGroup.add(uploadFolderAction);
    actionManager.registerAction("convertFolderToProject", convertFolderToProjectAction);
    projectGroup.add(convertFolderToProjectAction);
    actionManager.registerAction("downloadAsZipAction", downloadProjectAction);
    projectGroup.add(downloadProjectAction);
    actionManager.registerAction("showHideHiddenFiles", showHiddenFilesAction);
    projectGroup.add(showHiddenFilesAction);
    projectGroup.addSeparator();
    actionManager.registerAction("projectConfiguration", projectConfigurationAction);
    projectGroup.add(projectConfigurationAction);
    // Edit (New Menu)
    DefaultActionGroup editGroup = (DefaultActionGroup) actionManager.getAction(GROUP_EDIT);
    DefaultActionGroup recentGroup = new DefaultActionGroup(RECENT_GROUP_ID, true, actionManager);
    actionManager.registerAction(GROUP_RECENT_FILES, recentGroup);
    actionManager.registerAction("clearRecentList", clearRecentFilesAction);
    recentGroup.addSeparator();
    recentGroup.add(clearRecentFilesAction, LAST);
    editGroup.add(recentGroup);
    actionManager.registerAction(OPEN_RECENT_FILES, openRecentFilesAction);
    editGroup.add(openRecentFilesAction);
    editGroup.addSeparator();
    actionManager.registerAction(CLOSE_ACTIVE_EDITOR, closeActiveEditorAction);
    editGroup.add(closeActiveEditorAction);
    actionManager.registerAction(FORMAT, formatterAction);
    editGroup.add(formatterAction);
    actionManager.registerAction("undo", undoAction);
    editGroup.add(undoAction);
    actionManager.registerAction("redo", redoAction);
    editGroup.add(redoAction);
    actionManager.registerAction(CUT, cutResourceAction);
    editGroup.add(cutResourceAction);
    actionManager.registerAction(COPY, copyResourceAction);
    editGroup.add(copyResourceAction);
    actionManager.registerAction(PASTE, pasteResourceAction);
    editGroup.add(pasteResourceAction);
    actionManager.registerAction(RENAME, renameItemAction);
    editGroup.add(renameItemAction);
    actionManager.registerAction(DELETE_ITEM, deleteResourceAction);
    editGroup.add(deleteResourceAction);
    actionManager.registerAction(FULL_TEXT_SEARCH, fullTextSearchAction);
    editGroup.add(fullTextSearchAction);
    editGroup.addSeparator();
    editGroup.add(switchPreviousEditorAction);
    editGroup.add(switchNextEditorAction);
    editGroup.addSeparator();
    editGroup.add(revealResourceAction);
    // Assistant (New Menu)
    DefaultActionGroup assistantGroup = (DefaultActionGroup) actionManager.getAction(GROUP_ASSISTANT);
    actionManager.registerAction(FIND_ACTION, findActionAction);
    assistantGroup.add(findActionAction);
    actionManager.registerAction("hotKeysList", hotKeysListAction);
    assistantGroup.add(hotKeysListAction);
    assistantGroup.addSeparator();
    actionManager.registerAction("callCompletion", completeAction);
    assistantGroup.add(completeAction);
    actionManager.registerAction("downloadItemAction", downloadResourceAction);
    actionManager.registerAction(NAVIGATE_TO_FILE, navigateToFileAction);
    assistantGroup.add(navigateToFileAction);
    // Compose Save group
    DefaultActionGroup saveGroup = new DefaultActionGroup(actionManager);
    actionManager.registerAction("saveGroup", saveGroup);
    actionManager.registerAction("save", saveAction);
    actionManager.registerAction("saveAll", saveAllAction);
    saveGroup.addSeparator();
    saveGroup.add(saveAction);
    saveGroup.add(saveAllAction);
    //Compose Profile menu
    DefaultActionGroup profileGroup = (DefaultActionGroup) actionManager.getAction(GROUP_PROFILE);
    actionManager.registerAction("showPreferences", showPreferencesAction);
    profileGroup.add(showPreferencesAction);
    // Compose Help menu
    DefaultActionGroup helpGroup = (DefaultActionGroup) actionManager.getAction(GROUP_HELP);
    helpGroup.addSeparator();
    // Compose main context menu
    DefaultActionGroup resourceOperation = new DefaultActionGroup(actionManager);
    actionManager.registerAction("resourceOperation", resourceOperation);
    actionManager.registerAction("refreshPathAction", refreshPathAction);
    actionManager.registerAction("linkWithEditor", linkWithEditorAction);
    resourceOperation.addSeparator();
    resourceOperation.add(showReferenceAction);
    resourceOperation.add(goIntoAction);
    resourceOperation.add(editFileAction);
    resourceOperation.add(cutResourceAction);
    resourceOperation.add(copyResourceAction);
    resourceOperation.add(pasteResourceAction);
    resourceOperation.add(renameItemAction);
    resourceOperation.add(deleteResourceAction);
    resourceOperation.addSeparator();
    resourceOperation.add(downloadResourceAction);
    resourceOperation.add(refreshPathAction);
    resourceOperation.add(linkWithEditorAction);
    resourceOperation.addSeparator();
    resourceOperation.add(convertFolderToProjectAction);
    resourceOperation.addSeparator();
    DefaultActionGroup mainContextMenuGroup = (DefaultActionGroup) actionManager.getAction(GROUP_MAIN_CONTEXT_MENU);
    mainContextMenuGroup.add(newGroup, Constraints.FIRST);
    mainContextMenuGroup.addSeparator();
    mainContextMenuGroup.add(resourceOperation);
    DefaultActionGroup partMenuGroup = (DefaultActionGroup) actionManager.getAction(GROUP_PART_MENU);
    partMenuGroup.add(maximizePartAction);
    partMenuGroup.add(minimizePartAction);
    partMenuGroup.add(restorePartAction);
    actionManager.registerAction("expandEditor", expandEditorAction);
    DefaultActionGroup rightMenuGroup = (DefaultActionGroup) actionManager.getAction(GROUP_RIGHT_MAIN_MENU);
    rightMenuGroup.add(expandEditorAction, FIRST);
    // Compose main toolbar
    DefaultActionGroup changeResourceGroup = new DefaultActionGroup(actionManager);
    actionManager.registerAction("changeResourceGroup", changeResourceGroup);
    actionManager.registerAction("editFile", editFileAction);
    actionManager.registerAction("goInto", goIntoAction);
    actionManager.registerAction(SHOW_REFERENCE, showReferenceAction);
    actionManager.registerAction("collapseAll", collapseAllAction);
    actionManager.registerAction("openFile", openFileAction);
    actionManager.registerAction(SWITCH_LEFT_TAB, switchPreviousEditorAction);
    actionManager.registerAction(SWITCH_RIGHT_TAB, switchNextEditorAction);
    actionManager.registerAction("scrollFromSource", revealResourceAction);
    changeResourceGroup.add(cutResourceAction);
    changeResourceGroup.add(copyResourceAction);
    changeResourceGroup.add(pasteResourceAction);
    changeResourceGroup.add(deleteResourceAction);
    DefaultActionGroup mainToolbarGroup = (DefaultActionGroup) actionManager.getAction(GROUP_MAIN_TOOLBAR);
    mainToolbarGroup.add(newGroup);
    mainToolbarGroup.add(changeResourceGroup);
    toolbarPresenter.bindMainGroup(mainToolbarGroup);
    DefaultActionGroup centerToolbarGroup = (DefaultActionGroup) actionManager.getAction(GROUP_CENTER_TOOLBAR);
    toolbarPresenter.bindCenterGroup(centerToolbarGroup);
    DefaultActionGroup rightToolbarGroup = (DefaultActionGroup) actionManager.getAction(GROUP_RIGHT_TOOLBAR);
    toolbarPresenter.bindRightGroup(rightToolbarGroup);
    //Editor context menu group
    DefaultActionGroup editorTabContextMenu = (DefaultActionGroup) actionManager.getAction(GROUP_EDITOR_TAB_CONTEXT_MENU);
    editorTabContextMenu.add(closeAction);
    actionManager.registerAction(CLOSE, closeAction);
    editorTabContextMenu.add(closeAllAction);
    actionManager.registerAction(CLOSE_ALL, closeAllAction);
    editorTabContextMenu.add(closeOtherAction);
    actionManager.registerAction(CLOSE_OTHER, closeOtherAction);
    editorTabContextMenu.add(closeAllExceptPinnedAction);
    actionManager.registerAction(CLOSE_ALL_EXCEPT_PINNED, closeAllExceptPinnedAction);
    editorTabContextMenu.addSeparator();
    editorTabContextMenu.add(reopenClosedFileAction);
    actionManager.registerAction(REOPEN_CLOSED, reopenClosedFileAction);
    editorTabContextMenu.add(pinEditorTabAction);
    actionManager.registerAction(PIN_TAB, pinEditorTabAction);
    editorTabContextMenu.addSeparator();
    actionManager.registerAction(SPLIT_HORIZONTALLY, splitHorizontallyAction);
    editorTabContextMenu.add(splitHorizontallyAction);
    actionManager.registerAction(SPLIT_VERTICALLY, splitVerticallyAction);
    editorTabContextMenu.add(splitVerticallyAction);
    actionManager.registerAction(SIGNATURE_HELP, signatureHelpAction);
    DefaultActionGroup editorContextMenuGroup = new DefaultActionGroup(actionManager);
    actionManager.registerAction(GROUP_EDITOR_CONTEXT_MENU, editorContextMenuGroup);
    editorContextMenuGroup.add(undoAction);
    editorContextMenuGroup.add(redoAction);
    editorContextMenuGroup.addSeparator();
    editorContextMenuGroup.add(formatterAction);
    editorContextMenuGroup.addSeparator();
    editorContextMenuGroup.add(fullTextSearchAction);
    editorContextMenuGroup.add(closeActiveEditorAction);
    // Define hot-keys
    keyBinding.getGlobal().addKey(new KeyBuilder().action().alt().charCode('n').build(), NAVIGATE_TO_FILE);
    keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode('F').build(), FULL_TEXT_SEARCH);
    keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode('A').build(), FIND_ACTION);
    keyBinding.getGlobal().addKey(new KeyBuilder().alt().charCode('L').build(), FORMAT);
    keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode('c').build(), COPY);
    keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode('x').build(), CUT);
    keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode('v').build(), PASTE);
    keyBinding.getGlobal().addKey(new KeyBuilder().shift().charCode(KeyCodeMap.F6).build(), RENAME);
    keyBinding.getGlobal().addKey(new KeyBuilder().shift().charCode(KeyCodeMap.F7).build(), SHOW_REFERENCE);
    keyBinding.getGlobal().addKey(new KeyBuilder().alt().charCode(KeyCodeMap.ARROW_LEFT).build(), SWITCH_LEFT_TAB);
    keyBinding.getGlobal().addKey(new KeyBuilder().alt().charCode(KeyCodeMap.ARROW_RIGHT).build(), SWITCH_RIGHT_TAB);
    keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode('e').build(), OPEN_RECENT_FILES);
    keyBinding.getGlobal().addKey(new KeyBuilder().charCode(KeyCodeMap.DELETE).build(), DELETE_ITEM);
    keyBinding.getGlobal().addKey(new KeyBuilder().alt().charCode('N').build(), NEW_FILE);
    keyBinding.getGlobal().addKey(new KeyBuilder().alt().charCode('x').build(), CREATE_PROJECT);
    keyBinding.getGlobal().addKey(new KeyBuilder().alt().charCode('A').build(), IMPORT_PROJECT);
    if (UserAgent.isMac()) {
        keyBinding.getGlobal().addKey(new KeyBuilder().control().charCode('w').build(), CLOSE_ACTIVE_EDITOR);
        keyBinding.getGlobal().addKey(new KeyBuilder().control().charCode('p').build(), SIGNATURE_HELP);
    } else {
        keyBinding.getGlobal().addKey(new KeyBuilder().alt().charCode('w').build(), CLOSE_ACTIVE_EDITOR);
        keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode('p').build(), SIGNATURE_HELP);
    }
    final Map<String, Perspective> perspectives = perspectiveManager.getPerspectives();
    if (perspectives.size() > 1) {
        //if registered perspectives will be more then 2 Main Menu -> Window
        // will appears and contains all of them as sub-menu
        final DefaultActionGroup windowMenu = new DefaultActionGroup("Window", true, actionManager);
        actionManager.registerAction("Window", windowMenu);
        final DefaultActionGroup mainMenu = (DefaultActionGroup) actionManager.getAction(GROUP_MAIN_MENU);
        mainMenu.add(windowMenu);
        for (Perspective perspective : perspectives.values()) {
            final Action action = new Action(perspective.getPerspectiveName()) {

                @Override
                public void actionPerformed(ActionEvent e) {
                    perspectiveManager.setPerspectiveId(perspective.getPerspectiveId());
                }
            };
            actionManager.registerAction(perspective.getPerspectiveId(), action);
            windowMenu.add(action);
        }
    }
}
Also used : KeyBuilder(org.eclipse.che.ide.api.keybinding.KeyBuilder) Perspective(org.eclipse.che.ide.api.parts.Perspective) FullTextSearchAction(org.eclipse.che.ide.actions.FullTextSearchAction) UndoAction(org.eclipse.che.ide.actions.UndoAction) LinkWithEditorAction(org.eclipse.che.ide.actions.LinkWithEditorAction) MinimizePartAction(org.eclipse.che.ide.actions.common.MinimizePartAction) ConvertFolderToProjectAction(org.eclipse.che.ide.actions.ConvertFolderToProjectAction) NavigateToFileAction(org.eclipse.che.ide.actions.NavigateToFileAction) UploadFolderAction(org.eclipse.che.ide.actions.UploadFolderAction) RestorePartAction(org.eclipse.che.ide.actions.common.RestorePartAction) CloseAllAction(org.eclipse.che.ide.part.editor.actions.CloseAllAction) RenameItemAction(org.eclipse.che.ide.actions.RenameItemAction) SaveAction(org.eclipse.che.ide.actions.SaveAction) ShowHiddenFilesAction(org.eclipse.che.ide.actions.ShowHiddenFilesAction) CutResourceAction(org.eclipse.che.ide.resources.action.CutResourceAction) SplitVerticallyAction(org.eclipse.che.ide.part.editor.actions.SplitVerticallyAction) DownloadWsAction(org.eclipse.che.ide.actions.DownloadWsAction) DownloadResourceAction(org.eclipse.che.ide.actions.DownloadResourceAction) PinEditorTabAction(org.eclipse.che.ide.part.editor.actions.PinEditorTabAction) RevealResourceAction(org.eclipse.che.ide.resources.action.RevealResourceAction) SwitchNextEditorAction(org.eclipse.che.ide.part.editor.actions.SwitchNextEditorAction) ImportProjectAction(org.eclipse.che.ide.actions.ImportProjectAction) NewXmlFileAction(org.eclipse.che.ide.xml.NewXmlFileAction) SaveAllAction(org.eclipse.che.ide.actions.SaveAllAction) CloseAction(org.eclipse.che.ide.part.editor.actions.CloseAction) CloseOtherAction(org.eclipse.che.ide.part.editor.actions.CloseOtherAction) GoIntoAction(org.eclipse.che.ide.actions.GoIntoAction) EditFileAction(org.eclipse.che.ide.actions.EditFileAction) HotKeysListAction(org.eclipse.che.ide.actions.HotKeysListAction) ProjectConfigurationAction(org.eclipse.che.ide.actions.ProjectConfigurationAction) RedoAction(org.eclipse.che.ide.actions.RedoAction) NewFileAction(org.eclipse.che.ide.newresource.NewFileAction) FormatterAction(org.eclipse.che.ide.actions.FormatterAction) OpenFileAction(org.eclipse.che.ide.actions.OpenFileAction) ReopenClosedFileAction(org.eclipse.che.ide.part.editor.actions.ReopenClosedFileAction) FindActionAction(org.eclipse.che.ide.actions.find.FindActionAction) ShowPreferencesAction(org.eclipse.che.ide.actions.ShowPreferencesAction) ClearRecentListAction(org.eclipse.che.ide.part.editor.recent.ClearRecentListAction) NewFolderAction(org.eclipse.che.ide.newresource.NewFolderAction) PasteResourceAction(org.eclipse.che.ide.resources.action.PasteResourceAction) CollapseAllAction(org.eclipse.che.ide.actions.CollapseAllAction) OpenRecentFilesAction(org.eclipse.che.ide.part.editor.recent.OpenRecentFilesAction) CreateProjectAction(org.eclipse.che.ide.actions.CreateProjectAction) CompleteAction(org.eclipse.che.ide.actions.CompleteAction) ExpandEditorAction(org.eclipse.che.ide.actions.ExpandEditorAction) DownloadProjectAction(org.eclipse.che.ide.actions.DownloadProjectAction) MaximizePartAction(org.eclipse.che.ide.actions.common.MaximizePartAction) ShowReferenceAction(org.eclipse.che.ide.actions.ShowReferenceAction) DeleteResourceAction(org.eclipse.che.ide.actions.DeleteResourceAction) CloseAllExceptPinnedAction(org.eclipse.che.ide.part.editor.actions.CloseAllExceptPinnedAction) SplitHorizontallyAction(org.eclipse.che.ide.part.editor.actions.SplitHorizontallyAction) CopyResourceAction(org.eclipse.che.ide.resources.action.CopyResourceAction) SwitchPreviousEditorAction(org.eclipse.che.ide.part.editor.actions.SwitchPreviousEditorAction) SignatureHelpAction(org.eclipse.che.ide.actions.SignatureHelpAction) Action(org.eclipse.che.ide.api.action.Action) UploadFileAction(org.eclipse.che.ide.actions.UploadFileAction) CloseActiveEditorAction(org.eclipse.che.ide.actions.CloseActiveEditorAction) RefreshPathAction(org.eclipse.che.ide.actions.RefreshPathAction) ActionEvent(org.eclipse.che.ide.api.action.ActionEvent) DefaultActionGroup(org.eclipse.che.ide.api.action.DefaultActionGroup)

Aggregations

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 DownloadWsAction (org.eclipse.che.ide.actions.DownloadWsAction)1 EditFileAction (org.eclipse.che.ide.actions.EditFileAction)1 ExpandEditorAction (org.eclipse.che.ide.actions.ExpandEditorAction)1 FormatterAction (org.eclipse.che.ide.actions.FormatterAction)1 FullTextSearchAction (org.eclipse.che.ide.actions.FullTextSearchAction)1 GoIntoAction (org.eclipse.che.ide.actions.GoIntoAction)1 HotKeysListAction (org.eclipse.che.ide.actions.HotKeysListAction)1 ImportProjectAction (org.eclipse.che.ide.actions.ImportProjectAction)1 LinkWithEditorAction (org.eclipse.che.ide.actions.LinkWithEditorAction)1 NavigateToFileAction (org.eclipse.che.ide.actions.NavigateToFileAction)1 OpenFileAction (org.eclipse.che.ide.actions.OpenFileAction)1 ProjectConfigurationAction (org.eclipse.che.ide.actions.ProjectConfigurationAction)1