use of org.eclipse.ui.actions.ActionGroup 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.ActionGroup in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createWebActionGroup.
private ActionGroup createWebActionGroup() {
webMenu = new MenuManager("Web", MdwPlugin.getImageDescriptor("icons/webtools.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.web");
return new ActionGroup() {
@Override
public void fillContextMenu(IMenuManager menu) {
webMenu.removeAll();
IStructuredSelection selection = getSelection();
if (webLaunchApplies(selection) && selection.getFirstElement() instanceof WorkflowElement) {
if (((WorkflowElement) selection.getFirstElement()).getProject().checkRequiredVersion(5, 5)) {
webMenu.add(mdwHubAction);
} else {
webMenu.add(taskManagerAction);
webMenu.add(webToolsAction);
}
}
}
};
}
use of org.eclipse.ui.actions.ActionGroup in project mdw-designer by CenturyLinkCloud.
the class AutomatedTestActionGroup method createFormatActionGroup.
private ActionGroup createFormatActionGroup() {
formatMenu = new MenuManager("Format", null, MdwMenuManager.MDW_MENU_PREFIX + "format");
return new ActionGroup() {
@Override
public void fillContextMenu(IMenuManager menu) {
formatMenu.removeAll();
WorkflowProject project = view.getTestSuite().getProject();
formatMenu.add(formatFunctionTestResultsAction);
java.io.File resultsFile = project.getFunctionTestResultsFile();
formatFunctionTestResultsAction.setEnabled(resultsFile != null && resultsFile.exists());
formatMenu.add(formatLoadTestResultsAction);
resultsFile = project.getLoadTestResultsFile();
formatLoadTestResultsAction.setEnabled(resultsFile != null && resultsFile.exists());
}
};
}
Aggregations