Search in sources :

Example 1 with WorkflowAssetPage

use of com.centurylink.mdw.plugin.designer.wizards.WorkflowAssetPage in project mdw-designer by CenturyLinkCloud.

the class WorkflowAssetEditor method createWorkflowAsset.

@SuppressWarnings("restriction")
private WorkflowElement createWorkflowAsset() {
    if (isProcess()) {
        WorkflowElementActionHandler actionHandler = new WorkflowElementActionHandler();
        actionHandler.create(WorkflowProcess.class, getElement().getPackage());
        return null;
    } else {
        IWorkbench workbench = PlatformUI.getWorkbench();
        org.eclipse.ui.internal.dialogs.NewWizard wizard = new org.eclipse.ui.internal.dialogs.NewWizard();
        wizard.setCategoryId("mdw.designer.asset");
        wizard.init(workbench, new StructuredSelection(new Object[] { getElement().getPackage() }));
        IDialogSettings workbenchSettings = org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.getDefault().getDialogSettings();
        IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");
        if (wizardSettings == null)
            wizardSettings = workbenchSettings.addNewSection("NewWizardAction");
        wizardSettings.put("NewWizardSelectionPage.STORE_SELECTED_ID", getWizardId());
        wizard.setDialogSettings(wizardSettings);
        wizard.setForcePreviousAndNextButtons(true);
        if (isTaskTemplate() && getElement() instanceof Activity) {
            Activity activity = (Activity) getElement();
            if (activity.isAutoFormManualTask())
                wizardSettings.put(TaskTemplate.TASK_TYPE, TaskTemplate.AUTOFORM);
            else
                wizardSettings.put(TaskTemplate.TASK_TYPE, TaskTemplate.CUSTOM);
        }
        WizardDialog dialog = new WizardDialog(null, wizard);
        dialog.create();
        dialog.open();
        IWizardPage wizardPage = dialog.getCurrentPage();
        if (wizardPage instanceof WorkflowAssetPage)
            return ((WorkflowAssetPage) wizardPage).getWorkflowAsset();
    }
    return null;
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Activity(com.centurylink.mdw.plugin.designer.model.Activity) WorkflowAssetPage(com.centurylink.mdw.plugin.designer.wizards.WorkflowAssetPage) WorkflowElementActionHandler(com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler) IWorkbench(org.eclipse.ui.IWorkbench) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) IWizardPage(org.eclipse.jface.wizard.IWizardPage) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 2 with WorkflowAssetPage

use of com.centurylink.mdw.plugin.designer.wizards.WorkflowAssetPage in project mdw-designer by CenturyLinkCloud.

the class ParameterizedCombo method createParamAsset.

@SuppressWarnings("restriction")
private WorkflowAsset createParamAsset(String[] paramTypes) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    org.eclipse.ui.internal.dialogs.NewWizard wizard = new org.eclipse.ui.internal.dialogs.NewWizard();
    wizard.setCategoryId("mdw.designer.asset");
    wizard.init(workbench, new StructuredSelection(new Object[] { workflowElement.getPackage() }));
    IDialogSettings workbenchSettings = org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.getDefault().getDialogSettings();
    IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");
    if (wizardSettings == null)
        wizardSettings = workbenchSettings.addNewSection("NewWizardAction");
    wizardSettings.put("NewWizardSelectionPage.STORE_SELECTED_ID", getWizardId(paramTypes));
    wizard.setDialogSettings(wizardSettings);
    wizard.setForcePreviousAndNextButtons(true);
    WizardDialog dialog = new WizardDialog(null, wizard);
    dialog.create();
    dialog.open();
    IWizardPage wizardPage = dialog.getCurrentPage();
    if (wizardPage instanceof WorkflowAssetPage)
        return ((WorkflowAssetPage) wizardPage).getWorkflowAsset();
    else
        return null;
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) WorkflowAssetPage(com.centurylink.mdw.plugin.designer.wizards.WorkflowAssetPage) IWorkbench(org.eclipse.ui.IWorkbench) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) IWizardPage(org.eclipse.jface.wizard.IWizardPage) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

WorkflowAssetPage (com.centurylink.mdw.plugin.designer.wizards.WorkflowAssetPage)2 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 IWizardPage (org.eclipse.jface.wizard.IWizardPage)2 WizardDialog (org.eclipse.jface.wizard.WizardDialog)2 IWorkbench (org.eclipse.ui.IWorkbench)2 WorkflowElementActionHandler (com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler)1 Activity (com.centurylink.mdw.plugin.designer.model.Activity)1