Author: scabanovich
Date: 2010-01-28 11:20:04 -0500 (Thu, 28 Jan 2010)
New Revision: 19992
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesLoaderUtil.java
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/PageAdopt.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5757
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesLoaderUtil.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesLoaderUtil.java 2010-01-28
16:16:55 UTC (rev 19991)
+++
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesLoaderUtil.java 2010-01-28
16:20:04 UTC (rev 19992)
@@ -14,6 +14,7 @@
import org.jboss.tools.common.meta.XModelEntity;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
+import org.jboss.tools.common.model.util.XModelObjectUtil;
import org.jboss.tools.common.xml.XMLUtilities;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -116,32 +117,19 @@
protected String getChildEntity(XModelEntity entity, Element e) {
String n = e.getNodeName();
if("page".equals(entity.getXMLSubPath())) {
- String suff = (entity.getName().endsWith(SUFF_12))
- ? SUFF_12
- : (entity.getName().endsWith(SUFF_20))
- ? SUFF_20
- : (entity.getName().endsWith(SUFF_21))
- ? SUFF_21
- : (entity.getName().endsWith(SUFF_22))
- ? SUFF_22
- : null;
- if(suff == null) {
- System.out.println("Unknown suffix in seam page entity " +
entity.getName());
- suff = SUFF_20;
- }
if("navigation".equals(n)) {
NodeList nl = e.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node ni = nl.item(i);
if(ni.getNodeType() == Node.ELEMENT_NODE) {
if(ni.getNodeName().equals("rule")) {
- return ENT_NAVIGATION + suff;
+ return XModelObjectUtil.getVersionedChildEntity(entity, ENT_NAVIGATION);
} else {
- return ENT_NAVIGATION_RULE + suff;
+ return XModelObjectUtil.getVersionedChildEntity(entity, ENT_NAVIGATION_RULE);
}
}
}
- return ENT_NAVIGATION + suff;
+ return XModelObjectUtil.getVersionedChildEntity(entity, ENT_NAVIGATION);
}
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/PageAdopt.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/PageAdopt.java 2010-01-28
16:16:55 UTC (rev 19991)
+++
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/PageAdopt.java 2010-01-28
16:20:04 UTC (rev 19992)
@@ -172,9 +172,9 @@
// String n = path;
// if(n.lastIndexOf('.') > 0) n = n.substring(0,
n.lastIndexOf('.'));
// if(n.lastIndexOf('/') >= 0) n = n.substring(n.lastIndexOf('/') +
1);
- String suffix = DiagramAdopt.getPageSuffix(source.getModelEntity().getName());
- XModelObject cs = source.getModel().createModelObject(ENT_NAVIGATION_RULE + suffix,
null);
- XModelObject redirect =
source.getModel().createModelObject("SeamPageRedirect" + suffix, null);
+
+ XModelObject cs =
source.getModel().createModelObject(XModelObjectUtil.getVersionedChildEntity(source.getModelEntity(),
ENT_NAVIGATION_RULE), null);
+ XModelObject redirect =
source.getModel().createModelObject(XModelObjectUtil.getVersionedChildEntity(cs.getModelEntity(),
"SeamPageRedirect"), null);
redirect.setAttributeValue(ATTR_VIEW_ID, path);
cs.addChild(redirect);
//TODO