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);
}
};
}
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;
}
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;
}
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);
}
};
}
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;
}
Aggregations