Author: fbricon
Date: 2012-01-16 05:04:14 -0500 (Mon, 16 Jan 2012)
New Revision: 37858
Modified:
trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
Log:
JBIDE-10629 : Add a new "tag" attribute to Project Examples xml descriptors
Modified: trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml
===================================================================
---
trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml 2012-01-16
10:03:51 UTC (rev 37857)
+++
trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml 2012-01-16
10:04:14 UTC (rev 37858)
@@ -33,8 +33,7 @@
<extension
point="org.jboss.tools.project.examples.projectExamplesXml"
name="%JBoss_Tools_33_Community_Maven_Examples">
- <!-- TODO : rename to project-examples-maven-3.3.xml once M5 is out the door
-->
-
<
url>http://download.jboss.org/jbosstools/examples/project-examples-mav...
+
<
url>http://download.jboss.org/jbosstools/examples/project-examples-mav...
<experimental>false</experimental>
</extension>
</plugin>
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2012-01-16
10:03:51 UTC (rev 37857)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2012-01-16
10:04:14 UTC (rev 37858)
@@ -14,7 +14,9 @@
import java.math.BigDecimal;
import java.net.URL;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
@@ -45,6 +47,7 @@
private File file;
private IProjectExampleSite site;
private String defaultProfiles =""; //$NON-NLS-1$
+ private Set<String> tags;
public Project() {
name=""; //$NON-NLS-1$
@@ -265,4 +268,16 @@
public String toString() {
return getName();
}
+
+ public void setTags(Set<String> tags) {
+ this.tags = tags;
+ }
+
+ public Set<String> setTags() {
+ if (tags == null) {
+ tags = new HashSet<String>();
+ }
+ return tags;
+ }
+
}
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2012-01-16
10:03:51 UTC (rev 37857)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2012-01-16
10:04:14 UTC (rev 37858)
@@ -353,6 +353,9 @@
else if (nodeName.equals("mavenArchetype")) { //$NON-NLS-1$
parseMavenArchetype(project, child);
}
+ else if (nodeName.equals("tags")) { //$NON-NLS-1$
+ parseTags(project, child);
+ }
}
}
}
@@ -365,7 +368,22 @@
return list;
}
- private static void parseFixes(Project project, Element node) {
+ private static void parseTags(Project project, Element tagElement) {
+ String tagsValue = tagElement.getTextContent();
+ if (tagsValue != null) {
+ StringTokenizer tokenizer = new StringTokenizer(tagsValue.trim(),
",");//$NON-NLS-1$
+ Set<String> tags = new HashSet<String>();
+ while (tokenizer.hasMoreTokens()) {
+ String tag = tokenizer.nextToken().trim();
+ if (tag.length() > 0) {
+ tags.add(tag);
+ }
+ }
+ project.setTags(tags);
+ }
+ }
+
+ private static void parseFixes(Project project, Element node) {
NodeList children = node.getChildNodes();
int cLen = children.getLength();
for (int i = 0; i < cLen; i++) {
@@ -392,28 +410,28 @@
if (nodeName.equals("archetypeGroupId")) { //$NON-NLS-1$
archetypeModel.setArchetypeGroupId(getContent(child));
}
- if (nodeName.equals("archetypeArtifactId")) { //$NON-NLS-1$
+ else if (nodeName.equals("archetypeArtifactId")) { //$NON-NLS-1$
archetypeModel.setArchetypeArtifactId(getContent(child));
}
- if (nodeName.equals("archetypeVersion")) { //$NON-NLS-1$
+ else if (nodeName.equals("archetypeVersion")) { //$NON-NLS-1$
archetypeModel.setArchetypeVersion(getContent(child));
}
- if (nodeName.equals("archetypeRepository")) { //$NON-NLS-1$
+ else if (nodeName.equals("archetypeRepository")) { //$NON-NLS-1$
archetypeModel.setArchetypeRepository(getContent(child));
}
- if (nodeName.equals("groupId")) { //$NON-NLS-1$
+ else if (nodeName.equals("groupId")) { //$NON-NLS-1$
archetypeModel.setGroupId(getContent(child));
}
- if (nodeName.equals("artifactId")) { //$NON-NLS-1$
+ else if (nodeName.equals("artifactId")) { //$NON-NLS-1$
archetypeModel.setArtifactId(getContent(child));
}
- if (nodeName.equals("version")) { //$NON-NLS-1$
+ else if (nodeName.equals("version")) { //$NON-NLS-1$
archetypeModel.setVersion(getContent(child));
}
- if (nodeName.equals("javaPackage")) { //$NON-NLS-1$
+ else if (nodeName.equals("javaPackage")) { //$NON-NLS-1$
archetypeModel.setJavaPackage(getContent(child));
}
- if (nodeName.equals("properties")) { //$NON-NLS-1$
+ else if (nodeName.equals("properties")) { //$NON-NLS-1$
parseProperties(project, child);
}
}