[jbosstools-commits] JBoss Tools SVN: r43931 - trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Fri Sep 21 11:22:13 EDT 2012
Author: fbricon
Date: 2012-09-21 11:22:13 -0400 (Fri, 21 Sep 2012)
New Revision: 43931
Modified:
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/NewProjectExamplesStacksRequirementsPage.java
Log:
JBIDE-12254 : display archetype version in the Description field based on informations fetched from stacks.yml or project-example descriptor xml
Modified: trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/NewProjectExamplesStacksRequirementsPage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/NewProjectExamplesStacksRequirementsPage.java 2012-09-21 15:13:48 UTC (rev 43930)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/NewProjectExamplesStacksRequirementsPage.java 2012-09-21 15:22:13 UTC (rev 43931)
@@ -105,7 +105,6 @@
return "mavenArchetype";
}
-
@Override
public void setProjectExample(ProjectExample projectExample) {
super.setProjectExample(projectExample);
@@ -127,64 +126,72 @@
}
private void setArchetypeVersion() {
+
+ ArchetypeModel mavenArchetype = null;
+ StringBuilder description = new StringBuilder();
+
if (stacksArchetype == null) {
- return;
- }
-
- org.jboss.jdf.stacks.model.Archetype a;
-
- if (useBlankArchetype != null && useBlankArchetype.getSelection()) {
- a = stacksArchetype.getBlank();
-
+ description.append(projectExample.getDescription());
+ mavenArchetype = projectExample.getArchetypeModel();
} else {
- a = stacksArchetype;
- }
-
- version = null;
- //get selected runtime from combo
- if (serverTargetCombo != null && !serverTargetCombo.isDisposed()) {
- String wtpServerId = serverTargetCombo.getText();
- IRuntime wtpRuntime = serverRuntimes.get(wtpServerId);
- if (wtpRuntime != null && wtpRuntime.getRuntimeType() != null) {
- String wtpRuntimeId = wtpRuntime.getRuntimeType().getId();
- //System.err.println(wtpRuntimeId);
- Runtime stacksRuntime = StacksUtil.getRuntimeFromWtpId(stacks, wtpRuntimeId );
- if (stacksRuntime != null) {
- List<ArchetypeVersion> compatibleVersions = StacksUtil.getCompatibleArchetypeVersions(a, stacksRuntime);
- if (compatibleVersions != null && !compatibleVersions.isEmpty()) {
- version = compatibleVersions.get(0);
+ org.jboss.jdf.stacks.model.Archetype a;
+
+ if (useBlankArchetype != null && useBlankArchetype.getSelection()) {
+ a = stacksArchetype.getBlank();
+
+ } else {
+ a = stacksArchetype;
+ }
+
+ version = null;
+ //get selected runtime from combo
+ if (serverTargetCombo != null && !serverTargetCombo.isDisposed()) {
+ String wtpServerId = serverTargetCombo.getText();
+ IRuntime wtpRuntime = serverRuntimes.get(wtpServerId);
+ if (wtpRuntime != null && wtpRuntime.getRuntimeType() != null) {
+ String wtpRuntimeId = wtpRuntime.getRuntimeType().getId();
+ //System.err.println(wtpRuntimeId);
+ Runtime stacksRuntime = StacksUtil.getRuntimeFromWtpId(stacks, wtpRuntimeId );
+ if (stacksRuntime != null) {
+ List<ArchetypeVersion> compatibleVersions = StacksUtil.getCompatibleArchetypeVersions(a, stacksRuntime);
+ if (compatibleVersions != null && !compatibleVersions.isEmpty()) {
+ version = compatibleVersions.get(0);
+ }
+ } else {
+ //No stacks runtime matching that server id
}
- } else {
- //No stacks runtime matching that server id
}
}
+ //contains wtp runtime id
+
+ if (version == null) {
+ version = StacksUtil.getDefaultArchetypeVersion(a, stacks);
+ }
+
+ description.append(version.getArchetype().getDescription());
+
+ try {
+ mavenArchetype = createArchetypeModel(projectExample.getArchetypeModel(), version);
+
+ wizardContext.setProperty(MavenProjectConstants.ARCHETYPE_MODEL, mavenArchetype);
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
}
- //contains wtp runtime id
- if (version == null) {
- version = StacksUtil.getDefaultArchetypeVersion(a, stacks);
+ if (mavenArchetype != null) {
+ description.append("\r\n").append("\r\n")
+ .append("Project based on the ")
+ .append(mavenArchetype.getArchetypeGroupId())
+ .append(":")
+ .append(mavenArchetype.getArchetypeArtifactId())
+ .append(":")
+ .append(mavenArchetype.getArchetypeVersion())
+ .append(" Maven archetype");
}
- StringBuilder description = new StringBuilder(version.getArchetype().getDescription());
- description.append("\r\n").append("\r\n")
- .append("Project based on the ")
- .append(version.getArchetype().getGroupId())
- .append(":")
- .append(version.getArchetype().getArtifactId())
- .append(":")
- .append(version.getVersion())
- .append(" Maven archetype");
-
setDescriptionText(description.toString());
- ArchetypeModel mavenArchetype;
- try {
- mavenArchetype = createArchetypeModel(projectExample.getArchetypeModel(), version);
-
- wizardContext.setProperty(MavenProjectConstants.ARCHETYPE_MODEL, mavenArchetype);
- } catch (CloneNotSupportedException e) {
- e.printStackTrace();
- }
}
More information about the jbosstools-commits
mailing list