diff options
11 files changed, 18 insertions, 40 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java index 7fe55722c0..7510ddbc6b 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java @@ -327,7 +327,7 @@ abstract class BinaryAnnotatedElement throw new UnsupportedOperationException(); } - public TextRange getNameTextRange(CompilationUnit astRoot) { + public TextRange getNameTextRange() { throw new UnsupportedOperationException(); } diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceAnnotation.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceAnnotation.java index ac57f2b6a3..1260efaaba 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceAnnotation.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceAnnotation.java @@ -129,7 +129,10 @@ public abstract class SourceAnnotation return new AnnotatedElementAnnotationElementAdapter<Integer>(this.annotatedElement, daea); } - /** + protected CompilationUnit buildASTRoot() { + return this.getJavaResourceCompilationUnit().buildASTRoot(); + } + /** * Return the text range corresponding to the annotation. * If the annotation is missing, return <code>null</code>. @@ -142,7 +145,6 @@ public abstract class SourceAnnotation } /** - /** * Return the text range corresponding to the annotation. * If the annotation is missing, return <code>null</code>. */ diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceNode.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceNode.java index 4306de4867..bd83fec70d 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceNode.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceNode.java @@ -15,7 +15,6 @@ import java.util.List; import java.util.Vector; import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.ArrayInitializer; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.Expression; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.MemberValuePair; @@ -47,10 +46,6 @@ public abstract class SourceNode return (JavaResourceCompilationUnit) this.getRoot(); } - protected CompilationUnit buildASTRoot() { - return this.getJavaResourceCompilationUnit().buildASTRoot(); - } - protected void nestedAnnotationAdded(String listName, int index, NestableAnnotation addedAnnotation) { this.fireItemAdded(listName, index, addedAnnotation); } diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceAnnotatedElement.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceAnnotatedElement.java index 39d8cdb4b9..fde46cc189 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceAnnotatedElement.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceAnnotatedElement.java @@ -192,7 +192,7 @@ public interface JavaResourceAnnotatedElement /** * Return the text range for the member's name. */ - TextRange getNameTextRange(CompilationUnit astRoot); + TextRange getNameTextRange(); /** * Return the text range for the nestable annotation if it is currently diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java index 1539aec6dc..7c215be62b 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. + * Copyright (c) 2011, 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. @@ -103,7 +103,7 @@ public abstract class AbstractJavaAttributeMapping<A extends Annotation> @Override public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getAnnotation() == null ? getJavaResourceAttribute().getNameTextRange(astRoot) : getAnnotation().getTextRange(astRoot); + return getAnnotation() == null ? getJavaResourceAttribute().getNameTextRange() : getAnnotation().getTextRange(astRoot); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java index 8e59b6682e..cc03ba5808 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java @@ -311,7 +311,7 @@ public abstract class AbstractJavaType */ @Override public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getJavaResourceType().getNameTextRange(astRoot); + return getJavaResourceType().getNameTextRange(); } public void validate(List<IMessage> messages, IReporter reporter) { diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java index df21aa2d69..9ad05a69bb 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. + * Copyright (c) 2010, 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. @@ -356,7 +356,7 @@ public class GenericJavaPackageInfo @Override public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.resourcePackage.getNameTextRange(astRoot); + return this.resourcePackage.getNameTextRange(); } public void validate(List<IMessage> messages, IReporter reporter) { diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAdapter.java index 6723b50a33..a18a767616 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAdapter.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAdapter.java @@ -126,6 +126,6 @@ public class GenericJavaXmlAdapter @Override public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getJavaResourceType().getNameTextRange(astRoot); + return getJavaResourceType().getNameTextRange(); } } 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() ) ); } |