diff options
author | kmoore | 2012-07-20 20:59:30 +0000 |
---|---|---|
committer | kmoore | 2012-07-20 20:59:30 +0000 |
commit | 6502953d8ea80f49e95b6de6c2d1f9e523b42d5c (patch) | |
tree | dc464ce0929ad288804291d22fc74a7bc843d01e /jaxb | |
parent | 36a685a7708584f873f848fe85aff92b339e23f4 (diff) | |
download | webtools.dali-6502953d8ea80f49e95b6de6c2d1f9e523b42d5c.tar.gz webtools.dali-6502953d8ea80f49e95b6de6c2d1f9e523b42d5c.tar.xz webtools.dali-6502953d8ea80f49e95b6de6c2d1f9e523b42d5c.zip |
begin caching text ranges in JAXB annotations
Diffstat (limited to 'jaxb')
30 files changed, 136 insertions, 91 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaEnumConstant.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaEnumConstant.java index 479ee45894..3ec1e2b91d 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaEnumConstant.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaEnumConstant.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. @@ -158,7 +158,7 @@ public class GenericJavaEnumConstant } protected TextRange getValueTextRange(CompilationUnit astRoot) { - TextRange enumValueTextRange = getXmlEnumValueAnnotation().getValueTextRange(astRoot); + TextRange enumValueTextRange = getXmlEnumValueAnnotation().getValueTextRange(); return enumValueTextRange != null ? enumValueTextRange : getValidationTextRange(astRoot); } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorOrderAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorOrderAnnotation.java index 84d2402975..e004d5c263 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorOrderAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorOrderAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -9,7 +9,6 @@ ******************************************************************************/ package org.eclipse.jpt.jaxb.core.internal.resource.java; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation; import org.eclipse.jpt.common.core.resource.java.JavaResourceNode; import org.eclipse.jpt.common.core.utility.TextRange; @@ -51,7 +50,7 @@ public final class NullXmlAccessorOrderAnnotation } } - public TextRange getValueTextRange(CompilationUnit astRoot) { + public TextRange getValueTextRange() { return null; } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorTypeAnnotation.java index 18248a0e9b..a565d1fac8 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorTypeAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -9,7 +9,6 @@ ******************************************************************************/ package org.eclipse.jpt.jaxb.core.internal.resource.java; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation; import org.eclipse.jpt.common.core.resource.java.JavaResourceNode; import org.eclipse.jpt.common.core.utility.TextRange; @@ -51,7 +50,7 @@ public final class NullXmlAccessorTypeAnnotation } } - public TextRange getValueTextRange(CompilationUnit astRoot) { + public TextRange getValueTextRange() { return null; } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumValueAnnotation.java index ba178b4fda..6b25c0a53a 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumValueAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumValueAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -50,7 +50,7 @@ public final class NullXmlEnumValueAnnotation } } - public TextRange getValueTextRange(CompilationUnit astRoot) { + public TextRange getValueTextRange() { return null; } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorOrderAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorOrderAnnotation.java index f686d90601..3e6d0c64a5 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorOrderAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorOrderAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; import org.eclipse.jpt.common.core.utility.TextRange; @@ -65,7 +64,7 @@ public final class BinaryXmlAccessorOrderAnnotation return XmlAccessOrder.fromJavaAnnotationValue(this.getJdtMemberValue(JAXB.XML_ACCESSOR_ORDER__VALUE)); } - public TextRange getValueTextRange(CompilationUnit astRoot) { + public TextRange getValueTextRange() { throw new UnsupportedOperationException(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorTypeAnnotation.java index 363b4a4fad..892cf358e9 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorTypeAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; import org.eclipse.jpt.common.core.utility.TextRange; @@ -65,7 +64,7 @@ public final class BinaryXmlAccessorTypeAnnotation return XmlAccessType.fromJavaAnnotationValue(this.getJdtMemberValue(JAXB.XML_ACCESSOR_TYPE__VALUE)); } - public TextRange getValueTextRange(CompilationUnit astRoot) { + public TextRange getValueTextRange() { throw new UnsupportedOperationException(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyElementAnnotation.java index 0410afb97e..9d60148c89 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyElementAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyElementAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; import org.eclipse.jpt.common.core.utility.TextRange; @@ -72,7 +71,7 @@ public final class BinaryXmlAnyElementAnnotation return (Boolean) this.getJdtMemberValue(JAXB.XML_ANY_ELEMENT__LAX); } - public TextRange getLaxTextRange(CompilationUnit astRoot) { + public TextRange getLaxTextRange() { throw new UnsupportedOperationException(); } @@ -96,7 +95,7 @@ public final class BinaryXmlAnyElementAnnotation return (String) this.getJdtMemberValue(JAXB.XML_ANY_ELEMENT__VALUE); } - public TextRange getValueTextRange(CompilationUnit astRoot) { + public TextRange getValueTextRange() { throw new UnsupportedOperationException(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java index 53cc480a86..03f67ad9a0 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -63,7 +63,7 @@ public final class BinaryXmlEnumValueAnnotation return (String) this.getJdtMemberValue(JAXB.XML_ENUM_VALUE__VALUE); } - public TextRange getValueTextRange(CompilationUnit astRoot) { + public TextRange getValueTextRange() { throw new UnsupportedOperationException(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java index a925f2d5b6..0e9fc6a5db 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; import org.eclipse.jpt.common.core.utility.TextRange; @@ -63,7 +62,7 @@ public final class BinaryXmlMimeTypeAnnotation return (String) this.getJdtMemberValue(JAXB.XML_MIME_TYPE__VALUE); } - public TextRange getValueTextRange(CompilationUnit astRoot) { + public TextRange getValueTextRange() { throw new UnsupportedOperationException(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorOrderAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorOrderAnnotation.java index 381bdfa14d..3d5180e50f 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorOrderAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorOrderAnnotation.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.source; import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; @@ -37,6 +36,7 @@ public final class SourceXmlAccessorOrderAnnotation private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); private final AnnotationElementAdapter<String> valueAdapter; private XmlAccessOrder value; + private TextRange valueTextRange; public SourceXmlAccessorOrderAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { @@ -52,12 +52,14 @@ public final class SourceXmlAccessorOrderAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.value = this.buildValue(astAnnotation); + this.valueTextRange = this.buildValueTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); this.syncValue(this.buildValue(astAnnotation)); + this.valueTextRange = this.buildValueTextRange(astAnnotation); } @Override @@ -90,8 +92,12 @@ public final class SourceXmlAccessorOrderAnnotation return XmlAccessOrder.fromJavaAnnotationValue(this.valueAdapter.getValue(astAnnotation)); } - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); + public TextRange getValueTextRange() { + return this.valueTextRange; + } + + private TextRange buildValueTextRange(Annotation astAnnotation) { + return this.getElementTextRange(VALUE_ADAPTER, astAnnotation); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorTypeAnnotation.java index 0f45771a66..05ba5ca11e 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorTypeAnnotation.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.source; import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; @@ -37,6 +36,7 @@ public final class SourceXmlAccessorTypeAnnotation private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); private final AnnotationElementAdapter<String> valueAdapter; private XmlAccessType value; + private TextRange valueTextRange; public SourceXmlAccessorTypeAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { @@ -52,12 +52,14 @@ public final class SourceXmlAccessorTypeAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.value = this.buildValue(astAnnotation); + this.valueTextRange = this.buildValueTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); this.syncValue(this.buildValue(astAnnotation)); + this.valueTextRange = this.buildValueTextRange(astAnnotation); } @Override @@ -90,8 +92,12 @@ public final class SourceXmlAccessorTypeAnnotation return XmlAccessType.fromJavaAnnotationValue(this.valueAdapter.getValue(astAnnotation)); } - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); + public TextRange getValueTextRange() { + return this.valueTextRange; + } + + private TextRange buildValueTextRange(Annotation astAnnotation) { + return this.getElementTextRange(VALUE_ADAPTER, astAnnotation); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyElementAnnotation.java index 78a95c987f..21361dcfcd 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyElementAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyElementAnnotation.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.source; import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; @@ -41,10 +40,12 @@ public final class SourceXmlAnyElementAnnotation private final DeclarationAnnotationElementAdapter<Boolean> laxDeclarationAdapter; private final AnnotationElementAdapter<Boolean> laxAdapter; private Boolean lax; + private TextRange laxTextRange; private final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter; private final AnnotationElementAdapter<String> valueAdapter; private String value; + private TextRange valueTextRange; private String fullyQualifiedValueClassName; @@ -89,7 +90,9 @@ public final class SourceXmlAnyElementAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.lax = this.buildLax(astAnnotation); + this.laxTextRange = this.buildLaxTextRange(astAnnotation); this.value = this.buildValue(astAnnotation); + this.valueTextRange = this.buildValueTextRange(astAnnotation); this.fullyQualifiedValueClassName = this.buildFullyQualifiedValueClassName(astAnnotation); } @@ -97,7 +100,9 @@ public final class SourceXmlAnyElementAnnotation public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); this.syncLax(this.buildLax(astAnnotation)); + this.laxTextRange = this.buildLaxTextRange(astAnnotation); this.syncValue(this.buildValue(astAnnotation)); + this.valueTextRange = this.buildValueTextRange(astAnnotation); this.syncFullyQualifiedValueClassName(this.buildFullyQualifiedValueClassName(astAnnotation)); } @@ -131,8 +136,12 @@ public final class SourceXmlAnyElementAnnotation return this.laxAdapter.getValue(astAnnotation); } - public TextRange getLaxTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.laxDeclarationAdapter, astRoot); + public TextRange getLaxTextRange() { + return this.laxTextRange; + } + + private TextRange buildLaxTextRange(Annotation astAnnotation) { + return this.getElementTextRange(this.laxDeclarationAdapter, astAnnotation); } // ***** value @@ -157,8 +166,12 @@ public final class SourceXmlAnyElementAnnotation return this.valueAdapter.getValue(astAnnotation); } - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.valueDeclarationAdapter, astRoot); + public TextRange getValueTextRange() { + return this.valueTextRange; + } + + private TextRange buildValueTextRange(Annotation astAnnotation) { + return this.getElementTextRange(this.valueDeclarationAdapter, astAnnotation); } // ***** fully-qualified value class name diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java index 95bf2ac0e6..45833b4ee2 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java @@ -36,6 +36,7 @@ public final class SourceXmlEnumValueAnnotation private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); private final AnnotationElementAdapter<String> valueAdapter; private String value; + private TextRange valueTextRange; public SourceXmlEnumValueAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { super(parent, annotatedElement, DECLARATION_ANNOTATION_ADAPTER); @@ -54,12 +55,14 @@ public final class SourceXmlEnumValueAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.value = this.buildValue(astAnnotation); + this.valueTextRange = this.buildValueTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); this.syncValue(this.buildValue(astAnnotation)); + this.valueTextRange = this.buildValueTextRange(astAnnotation); } @Override @@ -91,8 +94,12 @@ public final class SourceXmlEnumValueAnnotation return this.valueAdapter.getValue(astAnnotation); } - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); + public TextRange getValueTextRange() { + return this.valueTextRange; + } + + private TextRange buildValueTextRange(Annotation astAnnotation) { + return this.getElementTextRange(VALUE_ADAPTER, astAnnotation); } public boolean valueTouches(int pos, CompilationUnit astRoot) { diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java index a708a23f87..db68ca34ee 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.source; import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; @@ -36,6 +35,7 @@ public final class SourceXmlMimeTypeAnnotation private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); private final AnnotationElementAdapter<String> valueAdapter; private String value; + private TextRange valueTextRange; public SourceXmlMimeTypeAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { super(parent, annotatedElement, DECLARATION_ANNOTATION_ADAPTER); @@ -54,12 +54,14 @@ public final class SourceXmlMimeTypeAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.value = this.buildValue(astAnnotation); + this.valueTextRange = this.buildValueTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); this.syncValue(this.buildValue(astAnnotation)); + this.valueTextRange = this.buildValueTextRange(astAnnotation); } @Override @@ -91,8 +93,12 @@ public final class SourceXmlMimeTypeAnnotation return this.valueAdapter.getValue(astAnnotation); } - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); + public TextRange getValueTextRange() { + return this.valueTextRange; + } + + private TextRange buildValueTextRange(Annotation astAnnotation) { + return this.getElementTextRange(VALUE_ADAPTER, astAnnotation); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorOrderAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorOrderAnnotation.java index 5eb213ca01..a12e82628b 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorOrderAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorOrderAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -9,7 +9,6 @@ ******************************************************************************/ package org.eclipse.jpt.jaxb.core.resource.java; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.resource.java.Annotation; import org.eclipse.jpt.common.core.utility.TextRange; @@ -23,7 +22,7 @@ import org.eclipse.jpt.common.core.utility.TextRange; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 3.0 + * @version 3.3 * @since 3.0 */ public interface XmlAccessorOrderAnnotation @@ -46,6 +45,6 @@ public interface XmlAccessorOrderAnnotation * Return the {@link TextRange} for the 'value' element. If the element * does not exist return the {@link TextRange} for the XmlAccessorOrder annotation. */ - TextRange getValueTextRange(CompilationUnit astRoot); + TextRange getValueTextRange(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorTypeAnnotation.java index b10dbac4b7..9b0ce3ce4f 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorTypeAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -9,7 +9,6 @@ ******************************************************************************/ package org.eclipse.jpt.jaxb.core.resource.java; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.resource.java.Annotation; import org.eclipse.jpt.common.core.utility.TextRange; @@ -23,7 +22,7 @@ import org.eclipse.jpt.common.core.utility.TextRange; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 3.0 + * @version 3.3 * @since 3.0 */ public interface XmlAccessorTypeAnnotation @@ -46,6 +45,6 @@ public interface XmlAccessorTypeAnnotation * Return the {@link TextRange} for the 'value' element. If the element * does not exist return the {@link TextRange} for the XmlAccessorType annotation. */ - TextRange getValueTextRange(CompilationUnit astRoot); + TextRange getValueTextRange(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyElementAnnotation.java index caf679c903..36947ec812 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyElementAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyElementAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -9,7 +9,6 @@ ******************************************************************************/ package org.eclipse.jpt.jaxb.core.resource.java; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.resource.java.Annotation; import org.eclipse.jpt.common.core.utility.TextRange; @@ -23,7 +22,7 @@ import org.eclipse.jpt.common.core.utility.TextRange; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 3.0 + * @version 3.3 * @since 3.0 */ public interface XmlAnyElementAnnotation @@ -46,7 +45,7 @@ public interface XmlAnyElementAnnotation * Return the {@link TextRange} for the 'lax' element. If the element * does not exist return the {@link TextRange} for the XmlAnyElement annotation. */ - TextRange getLaxTextRange(CompilationUnit astRoot); + TextRange getLaxTextRange(); /** * Corresponds to the 'value' element of the XmlAnyElement annotation. @@ -70,7 +69,7 @@ public interface XmlAnyElementAnnotation * Return the {@link TextRange} for the 'value' element. If the element * does not exist return the {@link TextRange} for the XmlAnyElement annotation. */ - TextRange getValueTextRange(CompilationUnit astRoot); + TextRange getValueTextRange(); /** * Return the fully-qualified value class name as resolved by the AST's bindings. diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumValueAnnotation.java index 6d70a2843c..f6e4ee130f 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumValueAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumValueAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -23,7 +23,7 @@ import org.eclipse.jpt.common.core.utility.TextRange; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 3.0 + * @version 3.3 * @since 3.0 */ public interface XmlEnumValueAnnotation @@ -47,7 +47,7 @@ public interface XmlEnumValueAnnotation * Return the {@link TextRange} for the 'value' element. If the element * does not exist return the {@link TextRange} for the XmlEnumValue annotation. */ - TextRange getValueTextRange(CompilationUnit astRoot); + TextRange getValueTextRange(); /** * Return whether the given position touches the 'value' element value. diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMimeTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMimeTypeAnnotation.java index 773ade4495..6fb1509caa 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMimeTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMimeTypeAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 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. @@ -9,7 +9,6 @@ ******************************************************************************/ package org.eclipse.jpt.jaxb.core.resource.java; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.resource.java.Annotation; import org.eclipse.jpt.common.core.utility.TextRange; @@ -23,7 +22,7 @@ import org.eclipse.jpt.common.core.utility.TextRange; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 3.0 + * @version 3.3 * @since 3.0 */ public interface XmlMimeTypeAnnotation @@ -46,6 +45,6 @@ public interface XmlMimeTypeAnnotation * Return the {@link TextRange} for the 'value' element. If the element * does not exist return the {@link TextRange} for the XmlMimeType annotation. */ - TextRange getValueTextRange(CompilationUnit astRoot); + TextRange getValueTextRange(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlDiscriminatorValue.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlDiscriminatorValue.java index e05479037a..2ae45cd1f3 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlDiscriminatorValue.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlDiscriminatorValue.java @@ -96,13 +96,13 @@ public class ELJavaXmlDiscriminatorValue IMessage.HIGH_SEVERITY, ELJaxbValidationMessages.XML_DISCRIMINATOR_VALUE__NOT_SPECIFIED, ELJavaXmlDiscriminatorValue.this, - getValueTextRange(astRoot))); + getValueTextRange())); return; } } - protected TextRange getValueTextRange(CompilationUnit astRoot) { + protected TextRange getValueTextRange() { // should never be null - return getAnnotation().getValueTextRange(astRoot); + return getAnnotation().getValueTextRange(); } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java index 48bf63d813..ba04a80547 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java @@ -220,7 +220,7 @@ public class ELJavaXmlInverseReferenceMapping }; protected TextRange getMappedByTextRange(CompilationUnit astRoot) { - TextRange textRange = getXmlInverseReferenceAnnotation().getMappedByTextRange(astRoot); + TextRange textRange = getXmlInverseReferenceAnnotation().getMappedByTextRange(); return (textRange != null) ? textRange : getValidationTextRange(astRoot); } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlDiscriminatorValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlDiscriminatorValueAnnotation.java index 9644af29a0..44573efafb 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlDiscriminatorValueAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlDiscriminatorValueAnnotation.java @@ -67,7 +67,7 @@ public class BinaryXmlDiscriminatorValueAnnotation return (String) this.getJdtMemberValue(ELJaxb.XML_DISCRIMINATOR_VALUE__VALUE); } - public TextRange getValueTextRange(CompilationUnit astRoot) { + public TextRange getValueTextRange() { throw new UnsupportedOperationException(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlInverseReferenceAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlInverseReferenceAnnotation.java index e2a600b5c9..1bf79a1a59 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlInverseReferenceAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlInverseReferenceAnnotation.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 @@ -67,7 +67,7 @@ public class BinaryXmlInverseReferenceAnnotation return (String) this.getJdtMemberValue(ELJaxb.XML_INVERSE_REFERENCE__MAPPED_BY); } - public TextRange getMappedByTextRange(CompilationUnit astRoot) { + public TextRange getMappedByTextRange() { throw new UnsupportedOperationException(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlTransformationAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlTransformationAnnotation.java index 7b9d0e60f4..72feba9df0 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlTransformationAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlTransformationAnnotation.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 @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.eclipselink.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; import org.eclipse.jpt.common.core.utility.TextRange; @@ -67,7 +66,7 @@ public class BinaryXmlTransformationAnnotation return (Boolean) this.getJdtMemberValue(ELJaxb.XML_TRANSFORMATION__OPTIONAL); } - public TextRange getOptionalTextRange(CompilationUnit astRoot) { + public TextRange getOptionalTextRange() { throw new UnsupportedOperationException(); } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlDiscriminatorValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlDiscriminatorValueAnnotation.java index 95231438b4..08c12349fb 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlDiscriminatorValueAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlDiscriminatorValueAnnotation.java @@ -39,6 +39,7 @@ public class SourceXmlDiscriminatorValueAnnotation private final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter; private final AnnotationElementAdapter<String> valueAdapter; private String value; + private TextRange valueTextRange; public SourceXmlDiscriminatorValueAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { @@ -76,12 +77,14 @@ public class SourceXmlDiscriminatorValueAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.value = buildValue(astAnnotation); + this.valueTextRange = this.buildValueTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); syncValue(buildValue(astAnnotation)); + this.valueTextRange = this.buildValueTextRange(astAnnotation); } @Override @@ -112,9 +115,13 @@ public class SourceXmlDiscriminatorValueAnnotation private String buildValue(Annotation astAnnotation) { return this.valueAdapter.getValue(astAnnotation); } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.valueDeclarationAdapter, astRoot); + + public TextRange getValueTextRange() { + return this.valueTextRange; + } + + private TextRange buildValueTextRange(Annotation astAnnotation) { + return this.getElementTextRange(this.valueDeclarationAdapter, astAnnotation); } public boolean valueTouches(int pos, CompilationUnit astRoot) { diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlInverseReferenceAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlInverseReferenceAnnotation.java index 0007b6a0a7..f11c4dba90 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlInverseReferenceAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlInverseReferenceAnnotation.java @@ -37,6 +37,7 @@ public class SourceXmlInverseReferenceAnnotation private final DeclarationAnnotationElementAdapter<String> mappedByDeclarationAdapter; private final AnnotationElementAdapter<String> mappedByAdapter; private String mappedBy; + private TextRange mappedByTextRange; public SourceXmlInverseReferenceAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { @@ -66,12 +67,14 @@ public class SourceXmlInverseReferenceAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.mappedBy = buildMappedBy(astAnnotation); + this.mappedByTextRange = this.buildMappedByTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); this.syncMappedBy(buildMappedBy(astAnnotation)); + this.mappedByTextRange = this.buildMappedByTextRange(astAnnotation); } @Override @@ -102,9 +105,13 @@ public class SourceXmlInverseReferenceAnnotation private String buildMappedBy(Annotation astAnnotation) { return this.mappedByAdapter.getValue(astAnnotation); } - - public TextRange getMappedByTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.mappedByDeclarationAdapter, astRoot); + + public TextRange getMappedByTextRange() { + return this.mappedByTextRange; + } + + private TextRange buildMappedByTextRange(Annotation astAnnotation) { + return this.getElementTextRange(this.mappedByDeclarationAdapter, astAnnotation); } public boolean mappedByTouches(int pos, CompilationUnit astRoot) { diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlTransformationAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlTransformationAnnotation.java index 4b27fd883d..100e1370e0 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlTransformationAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlTransformationAnnotation.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.eclipselink.core.internal.resource.java.source; import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; @@ -36,6 +35,7 @@ public class SourceXmlTransformationAnnotation private final DeclarationAnnotationElementAdapter<Boolean> optionalDeclarationAdapter; private final AnnotationElementAdapter<Boolean> optionalAdapter; private Boolean optional; + private TextRange optionalTextRange; public SourceXmlTransformationAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { @@ -65,12 +65,14 @@ public class SourceXmlTransformationAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.optional = buildOptional(astAnnotation); + this.optionalTextRange = this.buildOptionalTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); this.syncOptional(buildOptional(astAnnotation)); + this.optionalTextRange = this.buildOptionalTextRange(astAnnotation); } @Override @@ -101,8 +103,12 @@ public class SourceXmlTransformationAnnotation private Boolean buildOptional(Annotation astAnnotation) { return this.optionalAdapter.getValue(astAnnotation); } - - public TextRange getOptionalTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.optionalDeclarationAdapter, astRoot); + + public TextRange getOptionalTextRange() { + return this.optionalTextRange; + } + + private TextRange buildOptionalTextRange(Annotation astAnnotation) { + return this.getElementTextRange(this.optionalDeclarationAdapter, astAnnotation); } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlDiscriminatorValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlDiscriminatorValueAnnotation.java index d9312af1f0..06ae14f93a 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlDiscriminatorValueAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlDiscriminatorValueAnnotation.java @@ -9,7 +9,6 @@ *******************************************************************************/ package org.eclipse.jpt.jaxb.eclipselink.core.resource.java; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.resource.java.Annotation; import org.eclipse.jpt.common.core.utility.TextRange; @@ -23,7 +22,7 @@ import org.eclipse.jpt.common.core.utility.TextRange; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 3.2 + * @version 3.3 * @since 3.2 */ public interface XmlDiscriminatorValueAnnotation @@ -50,5 +49,5 @@ public interface XmlDiscriminatorValueAnnotation * Return the text range associated with the 'value' element. * Return the text range of this annotation if the element is absent. */ - TextRange getValueTextRange(CompilationUnit astRoot); + TextRange getValueTextRange(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlInverseReferenceAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlInverseReferenceAnnotation.java index b7b7a07a11..416ec22d0f 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlInverseReferenceAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlInverseReferenceAnnotation.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 @@ -23,7 +23,7 @@ import org.eclipse.jpt.common.core.utility.TextRange; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 3.2 + * @version 3.3 * @since 3.0 */ public interface XmlInverseReferenceAnnotation @@ -50,7 +50,7 @@ public interface XmlInverseReferenceAnnotation * Return the text range associated with the 'mappedBy' element. * Return the text range of this annotation if the element is absent. */ - TextRange getMappedByTextRange(CompilationUnit astRoot); + TextRange getMappedByTextRange(); /** * Return whether the specified text position is within the 'mappedBy' element. diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlTransformationAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlTransformationAnnotation.java index df7071765e..66007f4b32 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlTransformationAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlTransformationAnnotation.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 @@ -9,7 +9,6 @@ *******************************************************************************/ package org.eclipse.jpt.jaxb.eclipselink.core.resource.java; -import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.resource.java.Annotation; import org.eclipse.jpt.common.core.utility.TextRange; @@ -23,7 +22,7 @@ import org.eclipse.jpt.common.core.utility.TextRange; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 3.0 + * @version 3.3 * @since 3.0 */ public interface XmlTransformationAnnotation @@ -50,5 +49,5 @@ public interface XmlTransformationAnnotation * Return the text range associated with the 'optional' element. * Return the text range of this annotation if the element is absent. */ - TextRange getOptionalTextRange(CompilationUnit astRoot); + TextRange getOptionalTextRange(); } |