Example usage for org.springframework.ide.eclipse.boot.wizard PreferredSelections PreferredSelections

List of usage examples for org.springframework.ide.eclipse.boot.wizard PreferredSelections PreferredSelections

Introduction

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

Prototype

public PreferredSelections(IPreferenceStore store) 

Source Link

Usage

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

public NewSpringBootWizardModel(URLConnectionFactory urlConnectionFactory, String jsonUrl,
        IPreferenceStore prefs) throws Exception {
    this.popularities = new PopularityTracker(prefs);
    this.preferredSelections = new PreferredSelections(prefs);
    this.defaultDependencies = new DefaultDependencies(prefs);
    this.urlConnectionFactory = urlConnectionFactory;
    this.JSON_URL = jsonUrl;

    baseUrl = new LiveVariable<>("<computed>");
    baseUrlValidator = new UrlValidator("Base Url", baseUrl);

    discoverOptions(stringInputs, dependencies);
    dependencies.sort();// w  ww  . j av a2s  . co  m

    projectName = stringInputs.getField("name");
    projectName.validator(new NewProjectNameValidator(projectName.getVariable()));
    location = new LiveVariable<>(ProjectLocationSection.getDefaultProjectLocation(projectName.getValue()));
    locationValidator = new NewProjectLocationValidator("Location", location, projectName.getVariable());
    Assert.isNotNull(projectName, "The service at " + JSON_URL + " doesn't specify a 'name' text input");

    UrlMaker computedUrl = new UrlMaker(baseUrl);
    for (FieldModel<String> param : stringInputs) {
        computedUrl.addField(param);
    }
    computedUrl.addField(dependencies);
    for (RadioGroup group : radioGroups.getGroups()) {
        computedUrl.addField(group);
    }
    computedUrl.addListener(new ValueListener<String>() {
        public void gotValue(LiveExpression<String> exp, String value) {
            downloadUrl.setValue(value);
        }
    });

    addBuildTypeValidator();

    preferredSelections.restore(this);
    defaultDependencies.restore(dependencies);
}