diff options
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java')
-rw-r--r-- | jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java index 2a0c7a86ac..763e03fb7f 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.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; @@ -38,14 +37,17 @@ public final class SourceXmlAttributeAnnotation private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; private final AnnotationElementAdapter<String> nameAdapter; private String name; + private TextRange nameTextRange; private final DeclarationAnnotationElementAdapter<String> namespaceDeclarationAdapter; private final AnnotationElementAdapter<String> namespaceAdapter; private String namespace; + private TextRange namespaceTextRange; private final DeclarationAnnotationElementAdapter<Boolean> requiredDeclarationAdapter; private final AnnotationElementAdapter<Boolean> requiredAdapter; private Boolean required; + private TextRange requiredTextRange; // ********** constructors ********** @@ -91,16 +93,22 @@ public final class SourceXmlAttributeAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.name = this.buildName(astAnnotation); + this.nameTextRange = this.buildNameTextRange(astAnnotation); this.namespace = this.buildNamespace(astAnnotation); + this.namespaceTextRange = this.buildNamespaceTextRange(astAnnotation); this.required = this.buildRequired(astAnnotation); + this.requiredTextRange = this.buildRequiredTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); this.syncName(this.buildName(astAnnotation)); + this.nameTextRange = this.buildNameTextRange(astAnnotation); this.syncNamespace(this.buildNamespace(astAnnotation)); + this.namespaceTextRange = this.buildNamespaceTextRange(astAnnotation); this.syncRequired(this.buildRequired(astAnnotation)); + this.requiredTextRange = this.buildRequiredTextRange(astAnnotation); } @Override @@ -133,12 +141,16 @@ public final class SourceXmlAttributeAnnotation return this.nameAdapter.getValue(astAnnotation); } - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); + private TextRange buildNameTextRange(Annotation astAnnotation) { + return this.getElementTextRange(this.nameDeclarationAdapter, astAnnotation); + } + + public TextRange getNameTextRange() { + return this.nameTextRange; } - public boolean nameTouches(int pos, CompilationUnit astRoot) { - return elementTouches(this.nameDeclarationAdapter, pos, astRoot); + public boolean nameTouches(int pos) { + return this.textRangeTouches(this.nameTextRange, pos); } @@ -164,12 +176,16 @@ public final class SourceXmlAttributeAnnotation return this.namespaceAdapter.getValue(astAnnotation); } - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot); + private TextRange buildNamespaceTextRange(Annotation astAnnotation) { + return this.getElementTextRange(this.namespaceDeclarationAdapter, astAnnotation); + } + + public TextRange getNamespaceTextRange() { + return this.namespaceTextRange; } - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return elementTouches(this.namespaceDeclarationAdapter, pos, astRoot); + public boolean namespaceTouches(int pos) { + return this.textRangeTouches(this.namespaceTextRange, pos); } @@ -195,7 +211,12 @@ public final class SourceXmlAttributeAnnotation return this.requiredAdapter.getValue(astAnnotation); } - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.requiredDeclarationAdapter, astRoot); + private TextRange buildRequiredTextRange(Annotation astAnnotation) { + return this.getElementTextRange(this.requiredDeclarationAdapter, astAnnotation); } + + public TextRange getRequiredTextRange() { + return this.requiredTextRange; + } + } |