Author: scabanovich
Date: 2007-07-26 10:32:15 -0400 (Thu, 26 Jul 2007)
New Revision: 2684
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/PositionSearcher.java
Log:
EXIN-217 added computation of position for attribute name
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/PositionSearcher.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/PositionSearcher.java 2007-07-26
14:26:04 UTC (rev 2683)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/PositionSearcher.java 2007-07-26
14:32:15 UTC (rev 2684)
@@ -33,10 +33,15 @@
String attribute;
int startPosition;
int endPosition;
+ boolean selectAttributeName = false;
public PositionSearcher() {}
public void init(String text, XModelObject object, String attribute) {
+ if(attribute != null && attribute.startsWith("&")) {
+ selectAttributeName = true;
+ attribute = attribute.substring(1);
+ }
this.text = text;
this.object = object;
this.attribute = attribute;
@@ -63,6 +68,12 @@
if(xml.indexOf(".") < 0) {
String s = text.substring(startPosition, endPosition);
int i1 = s.indexOf(xml);
+ if(selectAttributeName) {
+ if(i1 < 0) return;
+ startPosition = startPosition + i1;
+ endPosition = startPosition + xml.length();
+ return;
+ }
int i2 = (i1 < 0) ? -1 : s.indexOf('"', i1 + 1);
int i3 = (i2 < 0) ? -1 : s.indexOf('"', i2 + 1);
if(i3 > 0) {
Show replies by date