Search in sources :

Example 81 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.

the class EventHandlerPage method fillProcessTreeCombo.

private void fillProcessTreeCombo() {
    processTreeCombo.removeAll();
    List<WorkflowPackage> packages = getProject().getTopLevelUserVisiblePackages();
    for (WorkflowPackage pkg : packages) {
        CTreeComboItem packageItem = new CTreeComboItem(processTreeCombo, SWT.NONE);
        packageItem.setText(pkg.getName());
        packageItem.setImage(pkg.getIconImage());
        for (WorkflowProcess process : pkg.getProcesses()) {
            CTreeComboItem processItem = new CTreeComboItem(packageItem, SWT.NONE);
            processItem.setText(process.getName());
            processItem.setImage(process.getIconImage());
        }
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) CTreeComboItem(com.centurylink.swt.widgets.CTreeComboItem) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 82 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.

the class ImportPackagePage method removeGitVersionedPackages.

/**
 * Not foolproof since it relies on asset XML naming convention. returns
 * emptyFolders to be pruned.
 */
private List<Folder> removeGitVersionedPackages(Folder folder) {
    List<Folder> emptyFolders = new ArrayList<>();
    Map<File, Folder> toRemove = new HashMap<>();
    for (WorkflowElement child : folder.getChildren()) {
        if (child instanceof Folder) {
            for (Folder emptyFolder : removeGitVersionedPackages((Folder) child)) {
                if (!emptyFolders.contains(emptyFolder))
                    emptyFolders.add(emptyFolder);
            }
        } else if (child instanceof File) {
            File file = (File) child;
            String pkgName = file.getName();
            if (file.getParent() instanceof Folder && pkgName.endsWith(".xml")) {
                pkgName = pkgName.substring(0, pkgName.length() - 3);
                int lastDash = pkgName.lastIndexOf('-');
                if (lastDash > 0) {
                    pkgName = pkgName.substring(0, lastDash);
                    for (WorkflowPackage gitPackage : getProject().getTopLevelPackages()) {
                        if (pkgName.equals(gitPackage.getName())) {
                            PluginMessages.log("Import excludes VCS package: " + pkgName);
                            toRemove.put(file, (Folder) file.getParent());
                        }
                    }
                }
            }
        }
    }
    if (!toRemove.isEmpty()) {
        getImportPackageWizard().getImportPackageSelectPage().setInfo("Some packages are not displayed since they exist in version control.");
        for (Map.Entry<File, Folder> file : toRemove.entrySet()) {
            Folder removeFrom = file.getValue();
            removeFrom.getChildren().remove(file.getKey());
            if (removeFrom.getChildren().isEmpty())
                emptyFolders.add(removeFrom);
        }
    }
    return emptyFolders;
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Folder(com.centurylink.mdw.plugin.designer.model.Folder) File(com.centurylink.mdw.plugin.designer.model.File) Map(java.util.Map) HashMap(java.util.HashMap) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 83 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.

the class ImportPackageWizard method init.

public void init(IWorkbench workbench, IStructuredSelection selection) {
    setDefaultPageImageDescriptor(MdwPlugin.getImageDescriptor("icons/mdw_wiz.png"));
    setNeedsProgressMonitor(true);
    setWindowTitle("MDW Import");
    importPackagePage = new ImportPackagePage();
    importPackageSelectPage = new ImportPackageSelectPage();
    topFolder = new Folder("assets");
    if (selection != null && selection.getFirstElement() instanceof WorkflowProject) {
        WorkflowProject workflowProject = (WorkflowProject) selection.getFirstElement();
        topFolder.setProject(workflowProject);
    } else if (selection != null && selection.getFirstElement() instanceof WorkflowPackage) {
        WorkflowPackage packageVersion = (WorkflowPackage) selection.getFirstElement();
        topFolder.setProject(packageVersion.getProject());
    } else {
        WorkflowProject workflowProject = WorkflowProjectManager.getInstance().findWorkflowProject(selection);
        if (workflowProject != null)
            topFolder.setProject(workflowProject);
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) Folder(com.centurylink.mdw.plugin.designer.model.Folder)

Example 84 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.

the class NewPackageWizard method init.

public void init(IWorkbench workbench, IStructuredSelection selection) {
    setDefaultPageImageDescriptor(MdwPlugin.getImageDescriptor("icons/mdw_wiz.png"));
    setNeedsProgressMonitor(true);
    newPackagePage = new NewPackagePage();
    newPackage = new WorkflowPackage();
    if (selection != null && selection.getFirstElement() instanceof WorkflowProject) {
        WorkflowProject workflowProject = (WorkflowProject) selection.getFirstElement();
        newPackage.setProject(workflowProject);
    } else if (selection != null && selection.getFirstElement() instanceof WorkflowElement) {
        WorkflowProject workflowProject = ((WorkflowElement) selection.getFirstElement()).getProject();
        newPackage.setProject(workflowProject);
    } else {
        WorkflowProject workflowProject = WorkflowProjectManager.getInstance().findWorkflowProject(selection);
        if (workflowProject != null)
            newPackage.setProject(workflowProject);
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 85 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.

the class WorkflowAssetWizard method init.

public void init(IWorkbench workbench, IStructuredSelection selection, WorkflowAsset asset) {
    setDefaultPageImageDescriptor(MdwPlugin.getImageDescriptor("icons/mdw_wiz.png"));
    setNeedsProgressMonitor(true);
    this.workflowAsset = asset;
    if (selection != null && selection.getFirstElement() instanceof WorkflowPackage) {
        WorkflowPackage packageVersion = (WorkflowPackage) selection.getFirstElement();
        workflowAsset.setPackage(packageVersion);
    } else if (selection != null && selection.getFirstElement() instanceof WorkflowProject) {
        WorkflowProject workflowProject = (WorkflowProject) selection.getFirstElement();
        if (workflowProject.isShowDefaultPackage())
            workflowAsset.setPackage(workflowProject.getDefaultPackage());
    } else if (selection != null && selection.getFirstElement() instanceof WorkflowElement) {
        WorkflowElement element = (WorkflowElement) selection.getFirstElement();
        workflowAsset.setPackage(element.getPackage());
    } else {
        WorkflowProject workflowProject = WorkflowProjectManager.getInstance().findWorkflowProject(selection);
        if (workflowProject != null)
            workflowAsset.setProject(workflowProject);
    }
    workflowAssetPage = new WorkflowAssetPage(workflowAsset);
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Aggregations

WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)85 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)31 ArrayList (java.util.ArrayList)27 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)25 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)21 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)17 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)11 GridData (org.eclipse.swt.layout.GridData)11 CoreException (org.eclipse.core.runtime.CoreException)9 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)9 DesignerProxy (com.centurylink.mdw.plugin.designer.DesignerProxy)8 List (java.util.List)8 Label (org.eclipse.swt.widgets.Label)8 JSONException (org.json.JSONException)8 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)7 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)7 Folder (com.centurylink.mdw.plugin.designer.model.Folder)7 IOException (java.io.IOException)7 InvocationTargetException (java.lang.reflect.InvocationTargetException)7