Author: scabanovich
Date: 2008-10-07 06:47:22 -0400 (Tue, 07 Oct 2008)
New Revision: 10705
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLModelObjectFinder.java
Log:
Algorithm for finding XModel object at offset in text is improved.
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLModelObjectFinder.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLModelObjectFinder.java 2008-10-07
10:45:32 UTC (rev 10704)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLModelObjectFinder.java 2008-10-07
10:47:22 UTC (rev 10705)
@@ -60,7 +60,11 @@
String childEntity = getChildEntity(chain.name, o);
if(childEntity != null) {
XModelObject[] cs = o.getChildren();
- if(cs.length <= chain.index) return o;
+ if(cs.length <= chain.index) {
+ XModelObject c = findModelObject(chain.child, o);
+ if(c != null) return c;
+ return o;
+ }
int index = -1;
for (int i = 0; i < cs.length; i++) {
if(chain.name != null &&
chain.name.equals(cs[i].getModelEntity().getXMLSubPath())) {
@@ -70,6 +74,8 @@
}
}
}
+ XModelObject c = findModelObject(chain.child, o);
+ if(c != null) return c;
return o;
} else {
XModelObject[] cs = o.getChildren();
Show replies by date