Search in sources :

Example 1 with ProjectConfigurator

use of com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator in project mdw-designer by CenturyLinkCloud.

the class JavaSource method beforeFileOpened.

@Override
public void beforeFileOpened() {
    ProjectConfigurator projConf = new ProjectConfigurator(getProject(), MdwPlugin.getSettings());
    IProgressMonitor monitor = new NullProgressMonitor();
    projConf.setJava(monitor);
    try {
        if (getProject().isRemote() && projConf.isJavaCapable() && !projConf.hasFrameworkJars()) {
            FrameworkUpdateDialog updateDlg = new FrameworkUpdateDialog(MdwPlugin.getShell(), MdwPlugin.getSettings(), getProject());
            if (updateDlg.open() == Dialog.OK) {
                // as
                String origVer = getProject().getMdwVersion();
                // reported
                // by server
                // or db
                // for
                getProject().setMdwVersion(updateDlg.getMdwVersion());
                // downloading
                projConf.initializeFrameworkJars();
                projConf.initializeWebAppJars();
                getProject().setMdwVersion(origVer);
            }
        } else if (!getProject().isCustomTaskManager() && !projConf.hasWebAppJars()) {
            projConf.initializeWebAppJars();
        }
    } catch (CoreException ex) {
        PluginMessages.uiError(ex, "Framework Jars", getProject());
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ProjectConfigurator(com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator) CoreException(org.eclipse.core.runtime.CoreException) FrameworkUpdateDialog(com.centurylink.mdw.plugin.designer.dialogs.FrameworkUpdateDialog)

Example 2 with ProjectConfigurator

use of com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator in project mdw-designer by CenturyLinkCloud.

the class WebUpdateAction method run.

/**
 * @see IActionDelegate#run(IAction)
 */
public void run(final IAction action) {
    IProject webProject = null;
    WorkflowProject workflowProject = null;
    try {
        if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).getFirstElement() instanceof IProject) {
            webProject = (IProject) ((IStructuredSelection) selection).getFirstElement();
            workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(webProject);
        }
        if (workflowProject == null) {
            MessageDialog.openError(shell, "MDW Update", "Selection must be a Workflow Web project.\n(Try refreshing Process Explorer view.)");
            return;
        }
        ProjectUpdater updater = new ProjectUpdater(workflowProject, MdwPlugin.getSettings());
        if (action.getId().equals("mdw.workflow.updateFrameworkWebJars")) {
            updater.updateWebProjectJars(null);
        } else if (action.getId().equals("mdw.workflow.associateWebAppSourceCode")) {
            ProgressMonitorDialog pmDialog = new MdwProgressMonitorDialog(shell);
            final WorkflowProject wfProject = workflowProject;
            pmDialog.run(true, false, new IRunnableWithProgress() {

                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    monitor.beginTask("Setting Java source attachment locations", 100);
                    monitor.worked(20);
                    ProjectConfigurator configurator = new ProjectConfigurator(wfProject, MdwPlugin.getSettings());
                    try {
                        configurator.createWebProjectSourceCodeAssociations(shell, monitor);
                    } catch (CoreException ex) {
                        PluginMessages.log(ex);
                    }
                }
            });
        }
    } catch (Exception ex) {
        PluginMessages.log(ex);
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ProjectConfigurator(com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator) CoreException(org.eclipse.core.runtime.CoreException) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) ProjectUpdater(com.centurylink.mdw.plugin.project.assembly.ProjectUpdater) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 3 with ProjectConfigurator

use of com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator in project mdw-designer by CenturyLinkCloud.

the class CustomTaskManager method addTo.

@Override
public boolean addTo(WorkflowProject project, IProgressMonitor monitor) throws ExtensionModuleException {
    monitor.worked(5);
    try {
        updateApplicationXml(project, project.getWebProjectName() + ".war", project.getWebProjectName(), new SubProgressMonitor(monitor, 5));
        MdwSettings mdwSettings = MdwPlugin.getSettings();
        ProjectInflator inflator = new ProjectInflator(project, mdwSettings);
        inflator.generateWebArtifacts(new SubProgressMonitor(monitor, 5));
        ProjectUpdater updater = new ProjectUpdater(project, mdwSettings);
        ProjectConfigurator configurator = new ProjectConfigurator(project, mdwSettings);
        updater.updateWebProjectJars(new SubProgressMonitor(monitor, 30));
        configurator.createWebProjectSourceCodeAssociations(null, monitor);
        monitor.worked(5);
    } catch (Exception ex) {
        throw new ExtensionModuleException(ex.getMessage(), ex);
    }
    return true;
}
Also used : ProjectInflator(com.centurylink.mdw.plugin.project.assembly.ProjectInflator) ProjectConfigurator(com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator) MdwSettings(com.centurylink.mdw.plugin.preferences.model.MdwSettings) ProjectUpdater(com.centurylink.mdw.plugin.project.assembly.ProjectUpdater) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) IOException(java.io.IOException) XmlException(org.apache.xmlbeans.XmlException)

Example 4 with ProjectConfigurator

use of com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator in project mdw-designer by CenturyLinkCloud.

the class LocalCloudProjectWizard method performFinish.

@Override
public boolean performFinish() {
    // can depend on
    project.setDefaultFilesToIgnoreDuringUpdate();
    // container selected
    ProjectInflator projectInflator = new ProjectInflator(project, MdwPlugin.getSettings());
    if (project.checkRequiredVersion(6, 0, 3))
        projectInflator.inflateCliCloudProject();
    else
        projectInflator.inflateCloudProject(getContainer());
    WorkflowProjectManager.addProject(project);
    // take care of any extension modules
    ExtensionModulesUpdater changer = new ExtensionModulesUpdater(getProject());
    changer.setAdds(project.getExtensionModules());
    changer.doChanges(getShell());
    if (!project.isRemote() && !project.isWar()) {
        BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {

            public void run() {
                // deployment assembly, and add the resources folder
                try {
                    ProjectConfigurator projConf = new ProjectConfigurator(getProject(), MdwPlugin.getSettings());
                    getProject().getSourceProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
                    if (getProject().isFilePersist())
                        projConf.removeDeploymentAssemblyResourceMappings(project.getAssetFolder());
                    else
                        projConf.removeDeploymentAssemblyResourceMappings(project.getTempFolder());
                    projConf.addDeploymentAssemblyResourceMappings(project.getSourceProject().getFolder("/src/main/resources"));
                } catch (CoreException ex) {
                    PluginMessages.uiError(ex, "Inflate Project", getProject());
                }
            }
        });
    }
    DesignerPerspective.promptForShowPerspective(activeWindow, project);
    return true;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ProjectInflator(com.centurylink.mdw.plugin.project.assembly.ProjectInflator) ProjectConfigurator(com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator) CoreException(org.eclipse.core.runtime.CoreException) ExtensionModulesUpdater(com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater)

Example 5 with ProjectConfigurator

use of com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator in project mdw-designer by CenturyLinkCloud.

the class Script method beforeFileOpened.

@Override
public void beforeFileOpened() {
    if (isGroovy()) {
        ProjectConfigurator projConf = new ProjectConfigurator(getProject(), MdwPlugin.getSettings());
        projConf.setGroovy(new NullProgressMonitor());
        try {
            if (getProject().isRemote() && projConf.isJavaCapable() && !projConf.hasFrameworkJars()) {
                FrameworkUpdateDialog updateDlg = new FrameworkUpdateDialog(MdwPlugin.getShell(), MdwPlugin.getSettings(), getProject());
                if (updateDlg.open() == Dialog.OK) {
                    // as
                    String origVer = getProject().getMdwVersion();
                    // reported
                    // by
                    // server
                    // or db
                    // for
                    getProject().setMdwVersion(updateDlg.getMdwVersion());
                    // downloading
                    projConf.initializeFrameworkJars();
                    getProject().setMdwVersion(origVer);
                }
            }
        } catch (CoreException ex) {
            PluginMessages.uiError(ex, "Framework Jars", getProject());
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ProjectConfigurator(com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator) CoreException(org.eclipse.core.runtime.CoreException) FrameworkUpdateDialog(com.centurylink.mdw.plugin.designer.dialogs.FrameworkUpdateDialog)

Aggregations

ProjectConfigurator (com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator)9 CoreException (org.eclipse.core.runtime.CoreException)9 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)6 FrameworkUpdateDialog (com.centurylink.mdw.plugin.designer.dialogs.FrameworkUpdateDialog)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 ProjectUpdater (com.centurylink.mdw.plugin.project.assembly.ProjectUpdater)3 MdwProgressMonitorDialog (com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog)2 ExtensionModulesUpdater (com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater)2 ProjectInflator (com.centurylink.mdw.plugin.project.assembly.ProjectInflator)2 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)2 IOException (java.io.IOException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 IProject (org.eclipse.core.resources.IProject)2 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)2 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 MdwSecurityException (com.centurylink.mdw.auth.MdwSecurityException)1 MdwSettings (com.centurylink.mdw.plugin.preferences.model.MdwSettings)1 MalformedURLException (java.net.MalformedURLException)1 GeneralSecurityException (java.security.GeneralSecurityException)1