Search in sources :

Example 1 with Init

use of com.centurylink.mdw.cli.Init in project mdw-designer by CenturyLinkCloud.

the class ProjectInflator method inflateCliCloudProject.

public void inflateCliCloudProject() {
    try {
        IRunnableWithProgress loader = new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                try {
                    monitor.beginTask("Inflating Workflow Project", 250);
                    monitor.worked(5);
                    // Download the templates
                    Init init = new Init(new File(ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile() + "/" + workflowProject.getName()));
                    if (workflowProject.getMdwVersion().indexOf("SNAPSHOT") > -1)
                        init.setSnapshots(true);
                    init.setMdwVersion(workflowProject.getMdwVersion());
                    init.setDiscoveryUrl(MdwPlugin.getSettings().getMdwReleasesUrl());
                    monitor.subTask("Downloading Templates");
                    monitor.worked(10);
                    init.run(new SwtProgressMonitor(monitor));
                    createGitRepository(monitor);
                    IProject sourceProject = workflowProject.getSourceProject();
                    PluginUtil.createFoldersAsNeeded(sourceProject, sourceProject.getFolder("/build/classes"), monitor);
                    PluginUtil.createFoldersAsNeeded(sourceProject, sourceProject.getFolder("/src/main/java"), monitor);
                    ProjectUpdater updater = new ProjectUpdater(getProject(), MdwPlugin.getSettings());
                    updater.updateFrameworkJars(new SubProgressMonitor(monitor, 150));
                    workflowProject.refreshProject();
                } catch (Exception ex) {
                    throw new InvocationTargetException(ex);
                }
            }
        };
        ProgressMonitorDialog progMonDlg = new MdwProgressMonitorDialog(MdwPlugin.getShell());
        progMonDlg.run(true, false, loader);
    } catch (Exception ex) {
        PluginMessages.uiError(ex, "Create Cloud Project", workflowProject);
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) Init(com.centurylink.mdw.cli.Init) SwtProgressMonitor(com.centurylink.mdw.plugin.designer.SwtProgressMonitor) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) IFile(org.eclipse.core.resources.IFile) File(java.io.File) IProject(org.eclipse.core.resources.IProject) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor) URISyntaxException(java.net.URISyntaxException) CoreException(org.eclipse.core.runtime.CoreException) IOException(java.io.IOException) ExecutionException(org.eclipse.core.commands.ExecutionException) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

Init (com.centurylink.mdw.cli.Init)1 SwtProgressMonitor (com.centurylink.mdw.plugin.designer.SwtProgressMonitor)1 MdwProgressMonitorDialog (com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog)1 File (java.io.File)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URISyntaxException (java.net.URISyntaxException)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 SubProgressMonitor (org.eclipse.core.runtime.SubProgressMonitor)1 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1