Search in sources :

Example 6 with ProjectConfigurator

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

the class JavaEditorValueProvider method beforeTempFileOpened.

@Override
public boolean beforeTempFileOpened() {
    ProjectConfigurator projConf = new ProjectConfigurator(getProject(), MdwPlugin.getSettings());
    projConf.setJava(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());
    }
    return true;
}
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)

Example 7 with ProjectConfigurator

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

the class ScriptEditorValueProvider method beforeTempFileOpened.

@Override
public boolean beforeTempFileOpened() {
    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());
        }
    }
    return true;
}
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)

Example 8 with ProjectConfigurator

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

the class WorkflowProject method setJava.

public boolean setJava() {
    ProjectConfigurator projConf = new ProjectConfigurator(this, MdwPlugin.getSettings());
    if (projConf.isJavaCapable()) {
        IProgressMonitor monitor = new NullProgressMonitor();
        projConf.setJava(monitor);
        try {
            if (!projConf.hasFrameworkJars()) {
                FrameworkUpdateDialog updateDlg = new FrameworkUpdateDialog(MdwPlugin.getShell(), MdwPlugin.getSettings(), getProject());
                if (updateDlg.open() == Dialog.OK) {
                    String origVer = getProject().getMdwVersion();
                    // for
                    getProject().setMdwVersion(updateDlg.getMdwVersion());
                    // downloading
                    projConf.initializeFrameworkJars();
                    projConf.initializeWebAppJars();
                    getProject().setMdwVersion(origVer);
                }
            }
        } catch (Exception ex) {
            PluginMessages.uiError(ex, "Open Java Source", this);
        }
        return true;
    }
    return false;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ProjectConfigurator(com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator) FrameworkUpdateDialog(com.centurylink.mdw.plugin.designer.dialogs.FrameworkUpdateDialog) CoreException(org.eclipse.core.runtime.CoreException) JSONException(org.json.JSONException) GeneralSecurityException(java.security.GeneralSecurityException) IOException(java.io.IOException) MdwSecurityException(com.centurylink.mdw.auth.MdwSecurityException) MalformedURLException(java.net.MalformedURLException)

Example 9 with ProjectConfigurator

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

the class ProjectUpdateAction method run.

/**
 * @see IActionDelegate#run(IAction)
 */
public void run(final IAction action) {
    IProject project = null;
    WorkflowProject workflowProject = null;
    try {
        if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).getFirstElement() instanceof IProject) {
            project = (IProject) ((IStructuredSelection) selection).getFirstElement();
            workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(project);
        }
        if (workflowProject == null) {
            MessageDialog.openError(shell, "MDW Update", "Selection must be a Workflow project.");
            return;
        }
        final ProjectUpdater updater = new ProjectUpdater(workflowProject, MdwPlugin.getSettings());
        if (action.getId().equals("mdw.workflow.updateFrameworkJars")) {
            updater.updateFrameworkJars(null);
            ExtensionModulesUpdater modulesUpdater = new ExtensionModulesUpdater(workflowProject);
            modulesUpdater.doUpdate(shell);
        } else if (action.getId().equals("mdw.workflow.associateFrameworkSourceCode")) {
            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.createFrameworkSourceCodeAssociations(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) ExtensionModulesUpdater(com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

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