Author: scabanovich
Date: 2011-11-18 14:30:05 -0500 (Fri, 18 Nov 2011)
New Revision: 36456
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/helpers/SeamPagesDiagramHelper.java
Log:
JBIDE-10194
https://issues.jboss.org/browse/JBIDE-10194
Fixed update in Seam pages diagram model..
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/helpers/SeamPagesDiagramHelper.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/helpers/SeamPagesDiagramHelper.java 2011-11-18
19:18:37 UTC (rev 36455)
+++
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/helpers/SeamPagesDiagramHelper.java 2011-11-18
19:30:05 UTC (rev 36456)
@@ -8,7 +8,6 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.XModelObjectUtil;
import org.jboss.tools.jst.web.model.ReferenceObject;
@@ -26,6 +25,7 @@
private Set<String> pageViewIds = new HashSet<String>();
private Map<String,XModelObject> exceptionItems = new
HashMap<String,XModelObject>();
private Map<String,XModelObject> targets = new
HashMap<String,XModelObject>();
+ private Set<String> changedTargets = new HashSet<String>();
public SeamPagesDiagramHelper(XModelObject diagram) {
this.diagram = diagram;
@@ -40,6 +40,7 @@
pageViewIds.clear();
exceptionItems.clear();
targets.clear();
+ changedTargets.clear();
this.config = diagram.getParent();
}
@@ -92,6 +93,11 @@
if(og != null) {
String opp = og.getPathPart();
if(!pp.equals(opp)) {
+ XModelObject og1 = diagram.getChildByPath(pp);
+ if(og1 != null) {
+ og1.removeFromParent();
+ changedTargets.add(toNavigationRulePathPart(og1.getAttributeValue(ATTR_PATH)));
+ }
pageItems.remove(opp);
og.setAttributeValue(ATTR_NAME, pp);
}
@@ -173,6 +179,7 @@
g.setAttributeValue(ATTR_PATH, path);
g.setAttributeValue(ATTR_TYPE, type);
diagram.addChild(g);
+ changedTargets.add(pp);
}
return g;
}
@@ -432,6 +439,9 @@
// String fvi = findBestMatch(path);
XModelObject g = getPage(path);
String target = (g == null) ? "" : g.getPathPart();
+ if(target != null && target.equals(output.getAttributeValue(ATTR_TARGET))
&& changedTargets.contains(target)) {
+ output.setAttributeValue(ATTR_TARGET, "");
+ }
output.setAttributeValue(ATTR_TARGET, target);
}