Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2012-07-20 18:51:09 +0000
committerkmoore2012-07-20 18:51:09 +0000
commit00e11e4dca3aee70fb72b3ba1d9db5fb5d17f07d (patch)
treee1abbdbef448143cab4d109e05a3b3d7b9d3b503 /jpa/plugins
parent18b8d3bc66a8b117c83467bc7d9e7c078c642f24 (diff)
downloadwebtools.dali-00e11e4dca3aee70fb72b3ba1d9db5fb5d17f07d.tar.gz
webtools.dali-00e11e4dca3aee70fb72b3ba1d9db5fb5d17f07d.tar.xz
webtools.dali-00e11e4dca3aee70fb72b3ba1d9db5fb5d17f07d.zip
change JavaResourceAnnotationElement.getNameTextRange API to not use CompilationUnit. caching the name text range in the implementation
Diffstat (limited to 'jpa/plugins')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java11
3 files changed, 6 insertions, 25 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
index e5f6c9dfa8..0e9e9f8aa3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
@@ -447,15 +447,7 @@ public abstract class AbstractJavaPersistentAttribute
}
public TextRange getSelectionTextRange() {
- return this.getSelectionTextRange(this.buildASTRoot());
- }
-
- protected TextRange getSelectionTextRange(CompilationUnit astRoot) {
- return this.getResourceAttribute().getNameTextRange(astRoot);
- }
-
- protected CompilationUnit buildASTRoot() {
- return this.getResourceAttribute().getJavaResourceCompilationUnit().buildASTRoot();
+ return this.getResourceAttribute().getNameTextRange();
}
public void dispose() {
@@ -608,7 +600,7 @@ public abstract class AbstractJavaPersistentAttribute
public TextRange getValidationTextRange(CompilationUnit astRoot) {
return this.isVirtual() ?
this.getOwningPersistentType().getValidationTextRange() :
- this.getSelectionTextRange(astRoot);
+ this.getSelectionTextRange();
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
index 119ac1d1e1..d9f6675ff8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
@@ -922,11 +922,7 @@ public abstract class AbstractJavaPersistentType
}
public TextRange getSelectionTextRange() {
- return this.getSelectionTextRange(this.buildASTRoot());
- }
-
- protected TextRange getSelectionTextRange(CompilationUnit astRoot) {
- return this.resourceType.getNameTextRange(astRoot);
+ return this.resourceType.getNameTextRange();
}
public void dispose() {
@@ -1015,7 +1011,7 @@ public abstract class AbstractJavaPersistentType
}
public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getSelectionTextRange(astRoot);
+ return this.getValidationTextRange();
}
public TextRange getValidationTextRange() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
index b1bd40dc54..0632f7460c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
@@ -18,7 +18,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.HashBag;
import org.eclipse.jpt.jpa.core.JpaProject;
@@ -292,15 +291,9 @@ public class GenericRootContextNode
}
}
- // TODO remove 'jrcu'
- // replace jrcu.getFile() with jrpt.getFile()
- // replace jrpt.getMappingAnnotation().getTextRange(jrcu.buildASTRoot())
- // with jrpt.getMappingAnnotation().getTextRange()
- // (new method #getTextRange() ?)
Iterable<String> typeMappingAnnotationNames = this.jpaProject.getTypeMappingAnnotationNames();
for (String orphan : orphans) {
JavaResourceAbstractType jrt = this.jpaProject.getJavaResourceType(orphan);
- JavaResourceCompilationUnit jrcu = jrt.getJavaResourceCompilationUnit();
if (jrt.isAnnotatedWithAnyOf(typeMappingAnnotationNames)) {
messages.add(
DefaultJpaValidationMessages.buildMessage(
@@ -308,7 +301,7 @@ public class GenericRootContextNode
JpaValidationMessages.PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
new String[] {jrt.getTypeBinding().getQualifiedName()},
jrt.getFile(),
- jrt.getNameTextRange(jrcu.buildASTRoot())
+ jrt.getNameTextRange()
)
);
}
@@ -319,7 +312,7 @@ public class GenericRootContextNode
JpaValidationMessages.PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
new String[] {jrt.getName()},
jrt.getFile(),
- jrt.getNameTextRange(jrcu.buildASTRoot())
+ jrt.getNameTextRange()
)
);
}

Back to the top