Example usage for org.springframework.ide.eclipse.boot.wizard.content CodeSet fromZip

List of usage examples for org.springframework.ide.eclipse.boot.wizard.content CodeSet fromZip

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.wizard.content CodeSet fromZip.

Prototype

public static CodeSet fromZip(String name, DownloadableItem zip, IPath root) 

Source Link

Usage

From source file:org.springframework.ide.eclipse.boot.wizard.NewSpringBootWizardModel.java

public void performFinish(IProgressMonitor mon) throws InvocationTargetException, InterruptedException {
    mon.beginTask("Importing " + baseUrl.getValue(), 4);
    updateUsageCounts();/*from w w w.j a va  2  s.  c  o m*/
    preferredSelections.save(this);
    DownloadManager downloader = null;
    try {
        downloader = new DownloadManager(urlConnectionFactory).allowUIThread(allowUIThread);

        DownloadableItem zip = new DownloadableItem(newURL(downloadUrl.getValue()), downloader);
        String projectNameValue = projectName.getValue();
        CodeSet cs = CodeSet.fromZip(projectNameValue, zip, new Path("/"));

        ImportStrategy strat = getImportStrategy();
        if (strat == null) {
            strat = BuildType.GENERAL.getDefaultStrategy();
        }
        IRunnableWithProgress oper = strat
                .createOperation(ImportUtils.importConfig(new Path(location.getValue()), projectNameValue, cs));
        oper.run(SubMonitor.convert(mon, 3));

        IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectNameValue);
        addToWorkingSets(project, SubMonitor.convert(mon, 1));

    } catch (IOException e) {
        throw new InvocationTargetException(e);
    } finally {
        if (downloader != null) {
            downloader.dispose();
        }
        mon.done();
    }
}