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