use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class NewProcessWizard method init.
public void init(IWorkbench workbench, IStructuredSelection selection) {
setDefaultPageImageDescriptor(MdwPlugin.getImageDescriptor("icons/mdw_wiz.png"));
setNeedsProgressMonitor(true);
newProcessPage = new NewProcessPage();
process = new WorkflowProcess();
if (selection != null && selection.getFirstElement() instanceof WorkflowPackage) {
WorkflowPackage processPackage = (WorkflowPackage) selection.getFirstElement();
process.setProject(processPackage.getProject());
process.setPackage(processPackage);
} else if (selection != null && selection.getFirstElement() instanceof WorkflowProject) {
WorkflowProject workflowProject = (WorkflowProject) selection.getFirstElement();
process.setProject(workflowProject);
if (workflowProject.isShowDefaultPackage())
process.setPackage(workflowProject.getDefaultPackage());
} else if (selection != null && selection.getFirstElement() instanceof WorkflowElement) {
WorkflowProject workflowProject = ((WorkflowElement) selection.getFirstElement()).getProject();
process.setProject(workflowProject);
} else {
WorkflowProject workflowProject = WorkflowProjectManager.getInstance().findWorkflowProject(selection);
if (workflowProject != null)
process.setProject(workflowProject);
}
}
use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class CopyDialog method nameAlreadyExists.
private boolean nameAlreadyExists(String name) {
WorkflowProject workflowProject = workflowElement.getProject();
PluginDataAccess dataAccess = workflowProject.getDataAccess();
if (workflowElement instanceof WorkflowProcess)
return dataAccess.processNameExists(targetPackage.getPackageVO(), name);
else if (workflowElement instanceof ExternalEvent)
return workflowProject.externalEventNameExists(name);
else if (workflowElement instanceof WorkflowAsset)
return targetPackage == null ? workflowProject.workflowAssetNameExists(name) : targetPackage.workflowAssetNameExists(name);
else
return false;
}
use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class WorkflowProjectManager method findRemoteWorkflowProjects.
private List<WorkflowProject> findRemoteWorkflowProjects(List<IProject> excludes) {
List<WorkflowProject> remoteProjects = new ArrayList<WorkflowProject>();
// new-style loaded from project settings files
for (IProject project : MdwPlugin.getWorkspaceRoot().getProjects()) {
// ignore closed, local and java projects
if (project.isOpen() && getWorkflowFacetedProject(project.getName()) == null && !excludes.contains(project)) {
WorkflowProject remoteProject = null;
try {
remoteProject = new ProjectPersist(new WorkflowProject()).read(project);
} catch (CoreException ex) {
PluginMessages.log(ex);
}
if (remoteProject != null) {
remoteProject.setRemote(true);
remoteProjects.add(remoteProject);
}
}
}
return remoteProjects;
}
use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class WorkflowProjectManager method resourceChanged.
/**
* Listen for projects added and removed from the workspace
*/
public void resourceChanged(IResourceChangeEvent event) {
if (MdwPlugin.getPluginId() == null)
// during eclipse shutdown
return;
if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
if (event.getDelta().getResource() instanceof IWorkspaceRoot) {
try {
for (IResourceDelta childDelta : event.getDelta().getAffectedChildren()) {
if (childDelta.getResource() instanceof IProject) {
IProject project = (IProject) childDelta.getResource();
if (childDelta.getKind() == IResourceDelta.ADDED || (childDelta.getKind() == IResourceDelta.CHANGED && (event.getDelta().getFlags() & IResourceDelta.OPEN) == 0 && project.isOpen())) {
// project added or opened
if (project.isOpen() && hasSettingsFile(project)) {
WorkflowProject wfProject = loadWorkflowProject(project);
if (hasWorkflowFacet(project)) {
if (hasEarFacet(project))
wfProject.setEarProjectName(project.getName());
else
wfProject.setCloudProject(true);
} else {
wfProject.setRemote(true);
}
if (!getWorkflowProjects().contains(wfProject)) {
getWorkflowProjects().add(wfProject);
fireProjectChangeEvent(wfProject, ChangeType.ELEMENT_CREATE);
}
}
} else if (childDelta.getKind() == IResourceDelta.REMOVED || (childDelta.getKind() == IResourceDelta.CHANGED && (event.getDelta().getFlags() & IResourceDelta.OPEN) == 0 && !project.isOpen())) {
// project deleted or closed
WorkflowProject wfProject = getWorkflowProject(project);
if (getWorkflowProjects().contains(wfProject)) {
getWorkflowProjects().remove(wfProject);
fireProjectChangeEvent(wfProject, ChangeType.ELEMENT_DELETE);
}
}
}
}
} catch (CoreException ex) {
PluginMessages.log(ex);
}
}
}
}
use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class WorkflowProjectManager method loadWorkflowProjects.
private List<WorkflowProject> loadWorkflowProjects() {
List<WorkflowProject> workflowProjects = new ArrayList<WorkflowProject>();
List<IProject> javaSourceProjectsForEars = new ArrayList<IProject>();
// local workflow projects (ear and cloud projects)
for (IFacetedProject facetedProject : findWorkflowFacetedProjects()) {
try {
if (facetedProject.getProject().isOpen()) {
boolean hasEarFacet = hasEarFacet(facetedProject.getProject());
WorkflowProject wfProject = loadWorkflowProject(facetedProject.getProject());
if (hasEarFacet) {
wfProject.setEarProjectName(facetedProject.getProject().getName());
javaSourceProjectsForEars.add(wfProject.getSourceProject());
} else {
wfProject.setCloudProject(true);
}
workflowProjects.add(wfProject);
}
} catch (Exception ex) {
PluginMessages.log(ex);
}
}
// remote workflow projects
workflowProjects.addAll(findRemoteWorkflowProjects(javaSourceProjectsForEars));
Collections.sort(workflowProjects);
for (WorkflowProject workflowProject : workflowProjects) workflowProject.initNoticeChecks();
PluginMessages.log("WorkflowProjectManager loaded", IStatus.INFO);
return workflowProjects;
}
Aggregations