Search in sources :

Example 1 with ProjectUpdater

use of com.centurylink.mdw.plugin.project.assembly.ProjectUpdater 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 2 with ProjectUpdater

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

the class CustomTaskManager method update.

@Override
public boolean update(WorkflowProject project, IProgressMonitor monitor) throws ExtensionModuleException {
    monitor.worked(5);
    try {
        ProjectUpdater updater = new ProjectUpdater(project, MdwPlugin.getSettings());
        updater.updateWebProjectJars(new SubProgressMonitor(monitor, 90));
        monitor.worked(5);
    } catch (Exception ex) {
        throw new ExtensionModuleException(ex.getMessage(), ex);
    }
    return true;
}
Also used : 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 3 with ProjectUpdater

use of com.centurylink.mdw.plugin.project.assembly.ProjectUpdater 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 ProjectUpdater

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

the class WebExtension method removeFrom.

@Override
public boolean removeFrom(WorkflowProject project, IProgressMonitor monitor) throws ExtensionModuleException, InterruptedException {
    monitor.worked(5);
    try {
        ProjectUpdater updater = new ProjectUpdater(project, MdwPlugin.getSettings());
        updater.removeWebLibs(getZipFile(project), new SubProgressMonitor(monitor, 90));
        monitor.worked(5);
    } catch (InterruptedException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new ExtensionModuleException(ex.getMessage(), ex);
    }
    return true;
}
Also used : ProjectUpdater(com.centurylink.mdw.plugin.project.assembly.ProjectUpdater) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor)

Example 5 with ProjectUpdater

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

the class ProjectSettingsPropertyPage method performOk.

public boolean performOk() {
    IProject project = (IProject) getElement();
    try {
        WorkflowProjectManager.getInstance().save(getProject(), project);
    } catch (CoreException ex) {
        PluginMessages.uiError(getShell(), ex, "Project Settings", getProject());
        return false;
    }
    if (getProject().getPersistType() == PersistType.Git && (!gitRepositoryUrlTextField.getText().trim().equals(originalGitRepositoryUrl) || !gitBranchTextField.getText().trim().equals(originalGitBranch) || !assetLocalPathTextField.getText().trim().equals(originalAssetLocalPath) || (includeArchiveCheckbox != null && includeArchiveCheckbox.getSelection() != originalIncludeArchive))) {
        getProject().getMdwVcsRepository().setEntrySource("projectSettingsPropertyPage");
        getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().getMdwVcsRepository());
    }
    if (databaseJdbcUrlTextField != null && !databaseJdbcUrlTextField.getText().trim().equals(originalJdbcUrl)) {
        getProject().getMdwDataSource().setEntrySource("projectSettingsPropertyPage");
        getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().getMdwDataSource());
    }
    if (mdwVersionComboBox != null && !mdwVersionComboBox.getText().equals(originalMdwVersion)) {
        getProject().fireElementChangeEvent(ChangeType.VERSION_CHANGE, getProject().getMdwVersion());
        if (MessageDialog.openQuestion(getShell(), "Update Framework Libraries", "The MDW version has changed.  Would you like to download updated framework libraries to match the new selection?")) {
            ProjectUpdater updater = new ProjectUpdater(getProject(), MdwPlugin.getSettings());
            try {
                updater.updateFrameworkJars(null);
                ExtensionModulesUpdater modulesUpdater = new ExtensionModulesUpdater(getProject());
                modulesUpdater.doUpdate(getShell());
            } catch (Exception ex) {
                PluginMessages.uiError(getShell(), ex, "Update Framework Libraries", getProject());
                return false;
            }
        }
        if (getProject().isOsgi())
            MessageDialog.openInformation(getShell(), "MDW Version Changed", "The MDW version has been updated in the plug-in settings file.  Please update any MDW dependencies in your pom.xml build file.");
    }
    if (getProject().isRemote()) {
        if (!hostTextField.getText().trim().equals(originalHost) || !portTextField.getText().trim().equals(String.valueOf(originalPort))) {
            getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().getServerSettings());
        }
        if (!contextRootTextField.getText().trim().equals(originalContextRoot)) {
            getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().getWebContextRoot());
        }
        if (syncSwitch != null && syncSwitch.getSelection() != originalSync) {
            WorkflowProjectManager.getInstance().makeLocal(getProject());
            getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().getMdwVcsRepository());
            MessageDialog.openInformation(getShell(), "Remote Project Unlocked", getProject().getName() + " has been unlocked.  Please close any open assets and refresh.");
        }
    }
    if (updateServerCacheCheckbox.getSelection() != originalRefreshServerCache)
        getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().isUpdateServerCache());
    return true;
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ProjectUpdater(com.centurylink.mdw.plugin.project.assembly.ProjectUpdater) ExtensionModulesUpdater(com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException)

Aggregations

ProjectUpdater (com.centurylink.mdw.plugin.project.assembly.ProjectUpdater)16 SubProgressMonitor (org.eclipse.core.runtime.SubProgressMonitor)11 IOException (java.io.IOException)7 CoreException (org.eclipse.core.runtime.CoreException)7 IProject (org.eclipse.core.resources.IProject)4 ExtensionModulesUpdater (com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater)3 ProjectConfigurator (com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator)3 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)3 MdwProgressMonitorDialog (com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 XmlException (org.apache.xmlbeans.XmlException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)2 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 PropertyEditor (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)1 ValueChangeListener (com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener)1 MdwSettings (com.centurylink.mdw.plugin.preferences.model.MdwSettings)1 ProjectInflator (com.centurylink.mdw.plugin.project.assembly.ProjectInflator)1 GradleBuildFile (com.centurylink.mdw.plugin.project.model.GradleBuildFile)1