Example usage for org.springframework.ide.eclipse.boot.wizard.content BuildType GENERAL

List of usage examples for org.springframework.ide.eclipse.boot.wizard.content BuildType GENERAL

Introduction

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

Prototype

BuildType GENERAL

To view the source code for org.springframework.ide.eclipse.boot.wizard.content BuildType GENERAL.

Click Source Link

Usage

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

/**
 * Fetch list of build types that are supported by the CodeSet. Note that
 * determining this information requires inspecting some of the directory
 * entries in the CodeSet and therefore it requires downloading the
 * content / zip / repo the CodeSet is contained in (unless it is
 * already cached locally)./*ww w. j a v  a  2 s  .com*/
 */
public List<BuildType> getBuildTypes() throws UIThreadDownloadDisallowed {
    //Only use 'default' build type if no other build type works.
    if (this.buildTypes == null) {
        //Careful if the code in here throws (e.g. because not yet downloaded and in UI thread...
        //then do NOT stick an empty list into this.buildTypes!
        ArrayList<BuildType> buildTypes = new ArrayList<BuildType>();
        for (BuildType type : BuildType.values()) {
            IPath scriptFile = type.getBuildScript();
            if (scriptFile != null && hasFile(scriptFile)) {
                buildTypes.add(type);
            }
        }
        if (buildTypes.isEmpty()) {
            buildTypes.add(BuildType.GENERAL);
        }
        this.buildTypes = buildTypes;
    }
    return this.buildTypes;
}

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();//  w  ww  .  j  av a2 s. c  om
    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();
    }
}