Search in sources :

Example 41 with WorkflowProject

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);
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 42 with 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;
}
Also used : WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) ExternalEvent(com.centurylink.mdw.plugin.designer.model.ExternalEvent) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) PluginDataAccess(com.centurylink.mdw.plugin.designer.PluginDataAccess)

Example 43 with WorkflowProject

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;
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ArrayList(java.util.ArrayList) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IProject(org.eclipse.core.resources.IProject)

Example 44 with WorkflowProject

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);
            }
        }
    }
}
Also used : IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) CoreException(org.eclipse.core.runtime.CoreException) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IProject(org.eclipse.core.resources.IProject) IResourceDelta(org.eclipse.core.resources.IResourceDelta)

Example 45 with WorkflowProject

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;
}
Also used : IFacetedProject(org.eclipse.wst.common.project.facet.core.IFacetedProject) ArrayList(java.util.ArrayList) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IProject(org.eclipse.core.resources.IProject) ResourceException(org.eclipse.core.internal.resources.ResourceException) CoreException(org.eclipse.core.runtime.CoreException) JavaModelException(org.eclipse.jdt.core.JavaModelException) MdwSecurityException(com.centurylink.mdw.auth.MdwSecurityException) DiscoveryException(com.centurylink.mdw.plugin.designer.DiscoveryException) XmlException(org.apache.xmlbeans.XmlException)

Aggregations

WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)128 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)31 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)25 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)22 ArrayList (java.util.ArrayList)22 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)21 CoreException (org.eclipse.core.runtime.CoreException)19 Action (org.eclipse.jface.action.Action)19 IAction (org.eclipse.jface.action.IAction)18 IProject (org.eclipse.core.resources.IProject)17 IFile (org.eclipse.core.resources.IFile)16 PartInitException (org.eclipse.ui.PartInitException)16 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)16 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)15 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)12 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)11 InvocationTargetException (java.lang.reflect.InvocationTargetException)11 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)11 IOException (java.io.IOException)10 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)9