Search in sources :

Example 6 with IWorkbenchAction

use of org.eclipse.ui.actions.ActionFactory.IWorkbenchAction in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createNewActionGroup.

private ActionGroup createNewActionGroup() {
    newMenu = new MenuManager("New", null, MdwMenuManager.MDW_MENU_PREFIX + "menu.new");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            newMenu.removeAll();
            IStructuredSelection selection = getSelection();
            if (!newMenuApplies(selection))
                return;
            if (!MdwPlugin.isRcp())
                newMenu.add(newCloudProjectAction);
            if (createApplies(WorkflowProject.class, selection))
                newMenu.add(newRemoteProjectAction);
            newMenu.add(new Separator());
            if (createApplies(WorkflowPackage.class, selection))
                newMenu.add(newPackageAction);
            if (createApplies(WorkflowProcess.class, selection))
                newMenu.add(newProcessAction);
            newMenu.add(new Separator());
            if (createApplies(Activity.class, selection)) {
                MenuManager activityMenu = new MenuManager("Activity", null, MdwMenuManager.MDW_MENU_PREFIX + "menu.new.activity");
                activityMenu.add(newGeneralActivityAction);
                activityMenu.add(newStartActivityAction);
                activityMenu.add(newAdapterActivityAction);
                activityMenu.add(newEvaluatorActivityAction);
                newMenu.add(activityMenu);
            }
            if (createApplies(ExternalEvent.class, selection)) {
                MenuManager eventHandlerMenu = new MenuManager("Event Handler", null, MdwMenuManager.MDW_MENU_PREFIX + "menu.new.event.handler");
                eventHandlerMenu.add(newEventHandlerAction);
                eventHandlerMenu.add(newCamelProcessHandlerAction);
                eventHandlerMenu.add(newCamelNotifyHandlerAction);
                newMenu.add(eventHandlerMenu);
            }
            newMenu.add(new Separator());
            if (createApplies(WorkflowAsset.class, selection)) {
                newMenu.add(new Separator());
                newMenu.add(newCamelRouteAction);
                newMenu.add(newJarFileAction);
                newMenu.add(newJavaSourceAction);
                newMenu.add(newJsonAction);
                newMenu.add(newKotlinAction);
                newMenu.add(newPageAction);
                newMenu.add(newReportAction);
                newMenu.add(newRuleAction);
                newMenu.add(newScriptAction);
                newMenu.add(newSpringConfigAction);
                if (selection.getFirstElement() instanceof WorkflowElement && ((WorkflowElement) selection.getFirstElement()).getProject().isFilePersist())
                    newMenu.add(newTaskTemplateAction);
                newMenu.add(newTemplateAction);
                newMenu.add(newTestCaseAction);
                newMenu.add(newTextResourceAction);
                newMenu.add(newWebResourceAction);
                newMenu.add(newWordDocAction);
                newMenu.add(newXmlDocAction);
                newMenu.add(newYamlAction);
                newMenu.add(newKotlinAction);
                newMenu.add(new Separator());
            }
            newMenu.add(new Separator(OTHER));
            IWorkbenchAction otherAction = ActionFactory.NEW.create(getViewSite().getWorkbenchWindow());
            otherAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "new.other");
            otherAction.setText(OTHER_DOT);
            newMenu.add(otherAction);
        }
    };
}
Also used : ActionGroup(org.eclipse.ui.actions.ActionGroup) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MdwMenuManager(com.centurylink.mdw.plugin.actions.MdwMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Separator(org.eclipse.jface.action.Separator) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 7 with IWorkbenchAction

use of org.eclipse.ui.actions.ActionFactory.IWorkbenchAction in project translationstudio8 by heartsome.

the class ResetPerspectiveHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IWorkbenchAction resetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE.create(window);
    resetPerspectiveAction.run();
    return null;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)

Example 8 with IWorkbenchAction

use of org.eclipse.ui.actions.ActionFactory.IWorkbenchAction in project translationstudio8 by heartsome.

the class SavePerspectiveHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IWorkbenchAction savePerspectiveAction = ActionFactory.SAVE_PERSPECTIVE.create(window);
    savePerspectiveAction.run();
    return null;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)

Example 9 with IWorkbenchAction

use of org.eclipse.ui.actions.ActionFactory.IWorkbenchAction in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createImportActionGroup.

private ActionGroup createImportActionGroup() {
    importMenu = new MenuManager("Import", MdwPlugin.getImageDescriptor("icons/import.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.import");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            importMenu.removeAll();
            IStructuredSelection selection = getSelection();
            WorkflowElement element = (WorkflowElement) selection.getFirstElement();
            if (!importMenuApplies(selection))
                return;
            if (importProjectApplies())
                importMenu.add(importProjectAction);
            if (importPackageApplies(selection))
                importMenu.add(importPackageAction);
            if (importVcsApplies(selection))
                importMenu.add(importVcsAction);
            if (importProcessApplies(selection)) {
                if (element instanceof WorkflowProcess) {
                    importProcessAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.new.process.version");
                    importProcessAction.setText("New Process Version...");
                } else {
                    importProcessAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.process");
                    importProcessAction.setText(PROCESS_DOT);
                }
                importMenu.add(importProcessAction);
            }
            if (importWorkflowAssetApplies(selection)) {
                if (element instanceof WorkflowAsset) {
                    WorkflowAsset asset = (WorkflowAsset) element;
                    // menu item text and icon are dynamic
                    importWorkflowAssetAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.new.asset.version");
                    importWorkflowAssetAction.setText("New " + asset.getTitle() + " Version...");
                    importWorkflowAssetAction.setImageDescriptor(MdwPlugin.getImageDescriptor(ICONS + asset.getIcon()));
                } else {
                    importWorkflowAssetAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.asset");
                    importWorkflowAssetAction.setText("Asset...");
                    importWorkflowAssetAction.setImageDescriptor(MdwPlugin.getImageDescriptor(ICON_DOC_GIF));
                }
                importMenu.add(importWorkflowAssetAction);
            }
            if (importAttributesApplies(selection)) {
                List<IAction> importAttrsActions = getImportAttributeActions(selection);
                if (!importAttrsActions.isEmpty()) {
                    MenuManager attributesMenu = new MenuManager("Attributes", MdwPlugin.getImageDescriptor("icons/attribute.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.import.attributes");
                    attributesMenu.removeAll();
                    for (IAction action : importAttrsActions) attributesMenu.add(action);
                    importMenu.add(attributesMenu);
                }
            }
            if (importTaskTemplateApplies(selection))
                importMenu.add(importTaskTemplateAction);
            importMenu.add(new Separator(OTHER));
            IWorkbenchAction otherAction = ActionFactory.IMPORT.create(getViewSite().getWorkbenchWindow());
            otherAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.other");
            otherAction.setText(OTHER_DOT);
            importMenu.add(otherAction);
        }
    };
}
Also used : IAction(org.eclipse.jface.action.IAction) ActionGroup(org.eclipse.ui.actions.ActionGroup) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MdwMenuManager(com.centurylink.mdw.plugin.actions.MdwMenuManager) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement) Separator(org.eclipse.jface.action.Separator)

Example 10 with IWorkbenchAction

use of org.eclipse.ui.actions.ActionFactory.IWorkbenchAction in project archi by archimatetool.

the class ArchiActionBarAdvisor method createEditMenu.

/**
 * Create the Editor menu
 * @return
 */
private MenuManager createEditMenu() {
    IWorkbenchWindow window = getActionBarConfigurer().getWindowConfigurer().getWindow();
    MenuManager menu = new MenuManager(Messages.ArchiActionBarAdvisor_13, IWorkbenchActionConstants.M_EDIT);
    menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
    menu.add(fActionUndo);
    menu.add(fActionRedo);
    menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
    menu.add(new Separator());
    menu.add(fActionCut);
    menu.add(fActionCopy);
    menu.add(fActionPaste);
    menu.add(fActionPasteSpecial);
    menu.add(fActionDelete);
    menu.add(new Separator(IWorkbenchActionConstants.CUT_EXT));
    menu.add(fActionDuplicate);
    menu.add(fActionRename);
    menu.add(new Separator(fActionRename.getId()));
    menu.add(fActionSelectAll);
    menu.add(fActionFindReplace);
    menu.add(new Separator(fActionSelectAll.getId()));
    menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    /*
         * On a Mac, there is a "Preferences" menu item under the application menu bar.
         */
    if (!PlatformUtils.isMac()) {
        IWorkbenchAction preferenceAction = ActionFactory.PREFERENCES.create(window);
        ActionContributionItem item = new ActionContributionItem(preferenceAction);
        menu.add(new Separator());
        menu.add(item);
    }
    menu.add(new Separator(IWorkbenchActionConstants.EDIT_END));
    return menu;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Aggregations

IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)14 IAction (org.eclipse.jface.action.IAction)6 Action (org.eclipse.jface.action.Action)4 IMenuManager (org.eclipse.jface.action.IMenuManager)4 MenuManager (org.eclipse.jface.action.MenuManager)4 Separator (org.eclipse.jface.action.Separator)4 MdwMenuManager (com.centurylink.mdw.plugin.actions.MdwMenuManager)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)3 ActionGroup (org.eclipse.ui.actions.ActionGroup)3 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)2 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)2 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 BooleanPrefAction (org.eclipse.egit.ui.internal.actions.BooleanPrefAction)1 RedoRetargetAction (org.eclipse.gef.ui.actions.RedoRetargetAction)1 UndoRetargetAction (org.eclipse.gef.ui.actions.UndoRetargetAction)1 ZoomInRetargetAction (org.eclipse.gef.ui.actions.ZoomInRetargetAction)1