diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot.wizard/src/org/springframework/ide/eclipse/boot/wizard/NewSpringBootWizardModel.java b/eclipse-extensions/org.springframework.ide.eclipse.boot.wizard/src/org/springframework/ide/eclipse/boot/wizard/NewSpringBootWizardModel.java index 02bb154d4..4f9575324 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.boot.wizard/src/org/springframework/ide/eclipse/boot/wizard/NewSpringBootWizardModel.java +++ b/eclipse-extensions/org.springframework.ide.eclipse.boot.wizard/src/org/springframework/ide/eclipse/boot/wizard/NewSpringBootWizardModel.java @@ -64,7 +64,6 @@ import org.springsource.ide.eclipse.commons.livexp.core.validators.NewProjectNam import org.springsource.ide.eclipse.commons.livexp.core.validators.UrlValidator; import org.springsource.ide.eclipse.commons.livexp.ui.ProjectLocationSection; import org.springsource.ide.eclipse.commons.livexp.util.Filter; -import org.springsource.ide.eclipse.commons.livexp.util.Log; import com.google.common.base.Objects; @@ -76,15 +75,6 @@ public class NewSpringBootWizardModel { private static final String NAME_PROPRTY_ID = "name"; private static final String ARTIFACT_PROPERTY_ID = "artifactId"; - private static final Map KNOWN_TYPES = new HashMap<>(); - static { - KNOWN_TYPES.put("gradle-project", BuildType.GRADLE); // New version of initialzr app - KNOWN_TYPES.put("maven-project", BuildType.MAVEN); // New versions of initialzr app - - KNOWN_TYPES.put("gradle.zip", BuildType.GRADLE); //Legacy, can remove when new initializr app uses "gradle-project" definitively - KNOWN_TYPES.put("starter.zip", BuildType.MAVEN); //Legacy, can remove when initializr app uses "maven-project" definitively - } - /** * Lists known query parameters that map onto a String input field. The default values for these * parameters will be pulled from the json spec document. @@ -440,14 +430,23 @@ public class NewSpringBootWizardModel { RadioGroup group = radioGroups.ensureGroup(groupName); group.label("Type:"); for (Type type : serviceSpec.getTypeOptions(groupName)) { - BuildType bt = KNOWN_TYPES.get(type.getId()); + BuildType bt = BuildType.valueOf(type.getBuild().toUpperCase()); if (bt!=null) { - for (ImportStrategy is : bt.getImportStrategies()) { + List importStrategies = bt.getImportStrategies(); + if (importStrategies.size() == 1) { + ImportStrategy is = importStrategies.get(0); TypeRadioInfo radio = new TypeRadioInfo(groupName, type, is); - radio.setLabel(is.displayName()); + radio.setLabel(type.getName()); group.add(radio); + } else { + for (ImportStrategy is : importStrategies) { + TypeRadioInfo radio = new TypeRadioInfo(groupName, type, is); + radio.setLabel(type.getName() + " - " + is.displayName()); + group.add(radio); + } } } + } //When a type is selected the 'baseUrl' should be update according to its action. group.getSelection().selection.addListener(new ValueListener() { diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/initializr/InitializrServiceSpec.java b/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/initializr/InitializrServiceSpec.java index 39f5b238c..a8d7aea1d 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/initializr/InitializrServiceSpec.java +++ b/eclipse-extensions/org.springframework.ide.eclipse.boot/src/org/springframework/ide/eclipse/boot/core/initializr/InitializrServiceSpec.java @@ -16,8 +16,10 @@ import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -146,6 +148,7 @@ public class InitializrServiceSpec { public static class Type extends Option { private String action; + private String build; public void setAction(String action) { this.action = action; @@ -154,8 +157,18 @@ public class InitializrServiceSpec { public String getAction() { return action; } + + public String getBuild() { + return build; + } + + public void setBuild(String build) { + this.build = build; + } + } + public static class Dependency extends Nameable implements IdAble{ private String id; @@ -373,19 +386,24 @@ public class InitializrServiceSpec { if (obj!=null && "action".equals(obj.optString("type"))) { String defaultValue = obj.optString("default", ""); JSONArray arr = obj.getJSONArray("values"); - Type[] options = new Type[arr.length()]; - for (int i = 0; i < options.length; i++) { + List options = new ArrayList<>(arr.length()); + for (int i = 0; i < arr.length(); i++) { JSONObject option = arr.getJSONObject(i); - options[i] = new Type(); String id = option.getString("id"); String name = option.getString("name"); String action = option.getString("action"); - options[i].setId(id); - options[i].setName(name); - options[i].setAction(action); - options[i].setDefault(id.equals(defaultValue)); + JSONObject tags = option.getJSONObject("tags"); + if ("project".equals(tags.optString("format", null))) { + Type type = new Type(); + type.setId(id); + type.setName(name); + type.setAction(action); + type.setBuild(tags.optString("build")); + type.setDefault(id.equals(defaultValue)); + options.add(type); + } } - return options; + return options.toArray(new Type[options.size()]); } } catch (JSONException e) { //ignore diff --git a/eclipse-language-servers/org.springsource.ide.eclipse.commons.tests.util/.classpath b/eclipse-language-servers/org.springsource.ide.eclipse.commons.tests.util/.classpath index 8ec682e06..626a83e9e 100644 --- a/eclipse-language-servers/org.springsource.ide.eclipse.commons.tests.util/.classpath +++ b/eclipse-language-servers/org.springsource.ide.eclipse.commons.tests.util/.classpath @@ -3,9 +3,6 @@ - - -