summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Butzke2012-10-04 07:56:33 (EDT)
committerKaren Butzke2012-10-04 08:00:13 (EDT)
commitfcb01261e33cdbe16b16179b18d138233e614ff1 (patch)
tree46e74bf056e95831f8eb39622b81c2049b9cfd17
parent4241aab93cf092e44d0fc21787fdb7ac4757881c (diff)
downloadwebtools.dali-fcb01261e33cdbe16b16179b18d138233e614ff1.zip
webtools.dali-fcb01261e33cdbe16b16179b18d138233e614ff1.tar.gz
webtools.dali-fcb01261e33cdbe16b16179b18d138233e614ff1.tar.bz2
cleaned up text ranges for persistence.xml nodes. Wanted the actual file name to be selected instead of just the open node for a class, mapping-file, or jar-file
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJarFileRef.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJavaClassRef.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlMappingFileRef.java8
6 files changed, 25 insertions, 8 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
index 1f0cd57..1a2fcc6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
@@ -104,7 +104,7 @@ public abstract class AbstractJarFileRef
}
public TextRange getSelectionTextRange() {
- return (this.xmlJarFileRef == null) ? null : this.xmlJarFileRef.getSelectionTextRange();
+ return (this.xmlJarFileRef == null) ? null : this.xmlJarFileRef.getFileNameTextRange();
}
public void dispose() {
@@ -316,7 +316,7 @@ public abstract class AbstractJarFileRef
}
protected TextRange getXmlJarFileRefTextRange() {
- return (this.xmlJarFileRef == null) ? null : this.xmlJarFileRef.getValidationTextRange();
+ return (this.xmlJarFileRef == null) ? null : this.xmlJarFileRef.getFileNameTextRange();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
index 6f54d82..3a4c82c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
@@ -253,7 +253,7 @@ public class GenericClassRef
}
public TextRange getSelectionTextRange() {
- return this.isVirtual() ? null : this.xmlJavaClassRef.getSelectionTextRange();
+ return this.isVirtual() ? null : this.xmlJavaClassRef.getJavaClassTextRange();
}
public void dispose() {
@@ -392,7 +392,7 @@ public class GenericClassRef
return (textRange != null) ? textRange : this.getPersistenceUnit().getValidationTextRange();
}
- public TextRange getXmlValidationTextRange() {
- return this.isVirtual() ? null : this.xmlJavaClassRef.getValidationTextRange();
+ protected TextRange getXmlValidationTextRange() {
+ return this.isVirtual() ? null : this.xmlJavaClassRef.getJavaClassTextRange();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java
index d771a87..eed6fb2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java
@@ -87,7 +87,7 @@ public class GenericOrmXmlRef
// ********** JpaStructureNode implementation **********
public TextRange getSelectionTextRange() {
- return this.xmlMappingFileRef.getSelectionTextRange();
+ return this.xmlMappingFileRef.getFileNameTextRange();
}
@@ -99,7 +99,7 @@ public class GenericOrmXmlRef
}
protected TextRange getXmlValidationTextRange() {
- return this.xmlMappingFileRef.getValidationTextRange();
+ return this.xmlMappingFileRef.getFileNameTextRange();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJarFileRef.java
index d384619..f19862b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJarFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJarFileRef.java
@@ -246,4 +246,9 @@ public class XmlJarFileRef extends EBaseObjectImpl implements EBaseObject
int offset = domNode.getStartOffset();
return new ReplaceEdit(offset + nameIndex, originalName.length(), newName);
}
+
+ public TextRange getFileNameTextRange(){
+ TextRange textRange = this.buildTextRange(this.getTextNode());
+ return textRange == null ? this.getValidationTextRange() : textRange;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJavaClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJavaClassRef.java
index 11fb18c..6b6a8a1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJavaClassRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJavaClassRef.java
@@ -18,6 +18,7 @@ import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
import org.eclipse.jpt.common.core.resource.xml.EBaseObject;
import org.eclipse.jpt.common.core.resource.xml.EBaseObjectImpl;
+import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.wst.common.internal.emf.resource.Translator;
@@ -255,4 +256,9 @@ public class XmlJavaClassRef extends EBaseObjectImpl implements EBaseObject
int offset = getTextNode().getStartOffset();
return new ReplaceEdit(offset, packageLength, newPackageName);
}
+
+ public TextRange getJavaClassTextRange(){
+ TextRange textRange = this.buildTextRange(this.getTextNode());
+ return textRange == null ? this.getValidationTextRange() : textRange;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlMappingFileRef.java
index 068a68d..b8b9a14 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlMappingFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlMappingFileRef.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -22,6 +22,7 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
import org.eclipse.jpt.common.core.resource.xml.EBaseObject;
import org.eclipse.jpt.common.core.resource.xml.EBaseObjectImpl;
+import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.wst.common.internal.emf.resource.Translator;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
@@ -274,4 +275,9 @@ public class XmlMappingFileRef extends EBaseObjectImpl implements EBaseObject
int offset = getTextNode().getStartOffset();
return new ReplaceEdit(offset, originalName.length(), destination.toString());
}
+
+ public TextRange getFileNameTextRange(){
+ TextRange textRange = this.buildTextRange(this.getTextNode());
+ return textRange == null ? this.getValidationTextRange() : textRange;
+ }
}