diff options
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java')
-rw-r--r-- | jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java | 86 |
1 files changed, 54 insertions, 32 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java index 3a4762e1f4..f6b2ee4a85 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java @@ -46,11 +46,13 @@ public final class SourceXmlElementAnnotation private final AnnotationElementAdapter<String> nameAdapter; private String name; private TextRange nameTextRange; + private TextRange nameValidationTextRange; private final DeclarationAnnotationElementAdapter<String> namespaceDeclarationAdapter; private final AnnotationElementAdapter<String> namespaceAdapter; private String namespace; private TextRange namespaceTextRange; + private TextRange namespaceValidationTextRange; private final DeclarationAnnotationElementAdapter<Boolean> nillableDeclarationAdapter; private final AnnotationElementAdapter<Boolean> nillableAdapter; @@ -163,37 +165,41 @@ public final class SourceXmlElementAnnotation @Override 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.nillable = this.buildNillable(astAnnotation); - this.nillableTextRange = this.buildNillableTextRange(astAnnotation); - this.required = this.buildRequired(astAnnotation); - this.requiredTextRange = this.buildRequiredTextRange(astAnnotation); - this.defaultValue = this.buildDefaultValue(astAnnotation); - this.defaultValueTextRange = this.buildDefaultValueTextRange(astAnnotation); - this.type = this.buildType(astAnnotation); - this.fullyQualifiedTypeName = this.buildFullyQualifiedTypeName(astAnnotation); - this.typeTextRange = this.buildTypeTextRange(astAnnotation); + this.name = buildName(astAnnotation); + this.nameTextRange = buildNameTextRange(astAnnotation); + this.nameValidationTextRange = buildNameValidationTextRange(astAnnotation); + this.namespace = buildNamespace(astAnnotation); + this.namespaceTextRange = buildNamespaceTextRange(astAnnotation); + this.namespaceValidationTextRange = buildNamespaceValidationTextRange(astAnnotation); + this.nillable = buildNillable(astAnnotation); + this.nillableTextRange = buildNillableTextRange(astAnnotation); + this.required = buildRequired(astAnnotation); + this.requiredTextRange = buildRequiredTextRange(astAnnotation); + this.defaultValue = buildDefaultValue(astAnnotation); + this.defaultValueTextRange = buildDefaultValueTextRange(astAnnotation); + this.type = buildType(astAnnotation); + this.fullyQualifiedTypeName = buildFullyQualifiedTypeName(astAnnotation); + this.typeTextRange = buildTypeTextRange(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.syncNillable(this.buildNillable(astAnnotation)); - this.nillableTextRange = this.buildNillableTextRange(astAnnotation); - this.syncRequired(this.buildRequired(astAnnotation)); - this.requiredTextRange = this.buildRequiredTextRange(astAnnotation); - this.syncDefaultValue(this.buildDefaultValue(astAnnotation)); - this.defaultValueTextRange = this.buildDefaultValueTextRange(astAnnotation); - this.syncType(this.buildType(astAnnotation)); - this.syncFullyQualifiedTypeName(this.buildFullyQualifiedTypeName(astAnnotation)); - this.typeTextRange = this.buildTypeTextRange(astAnnotation); + this.syncName(buildName(astAnnotation)); + this.nameTextRange = buildNameTextRange(astAnnotation); + this.nameValidationTextRange = buildNameValidationTextRange(astAnnotation); + this.syncNamespace(buildNamespace(astAnnotation)); + this.namespaceTextRange = buildNamespaceTextRange(astAnnotation); + this.namespaceValidationTextRange = buildNamespaceValidationTextRange(astAnnotation); + this.syncNillable(buildNillable(astAnnotation)); + this.nillableTextRange = buildNillableTextRange(astAnnotation); + this.syncRequired(buildRequired(astAnnotation)); + this.requiredTextRange = buildRequiredTextRange(astAnnotation); + this.syncDefaultValue(buildDefaultValue(astAnnotation)); + this.defaultValueTextRange = buildDefaultValueTextRange(astAnnotation); + this.syncType(buildType(astAnnotation)); + this.syncFullyQualifiedTypeName(buildFullyQualifiedTypeName(astAnnotation)); + this.typeTextRange = buildTypeTextRange(astAnnotation); } @Override @@ -225,15 +231,23 @@ public final class SourceXmlElementAnnotation private String buildName(Annotation astAnnotation) { return this.nameAdapter.getValue(astAnnotation); } - + private TextRange buildNameTextRange(Annotation astAnnotation) { - return this.getElementTextRange(this.nameDeclarationAdapter, astAnnotation); + return getAnnotationElementTextRange(this.nameDeclarationAdapter, astAnnotation); } - + + private TextRange buildNameValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(this.nameDeclarationAdapter, astAnnotation); + } + public TextRange getNameTextRange() { return this.nameTextRange; } + public TextRange getNameValidationTextRange() { + return this.nameValidationTextRange; + } + public boolean nameTouches(int pos) { return this.textRangeTouches(this.nameTextRange, pos); } @@ -260,15 +274,23 @@ public final class SourceXmlElementAnnotation private String buildNamespace(Annotation astAnnotation) { return this.namespaceAdapter.getValue(astAnnotation); } - + private TextRange buildNamespaceTextRange(Annotation astAnnotation) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astAnnotation); + return getAnnotationElementTextRange(this.namespaceDeclarationAdapter, astAnnotation); } - + + private TextRange buildNamespaceValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(this.namespaceDeclarationAdapter, astAnnotation); + } + public TextRange getNamespaceTextRange() { return this.namespaceTextRange; } + public TextRange getNamespaceValidationTextRange() { + return this.namespaceValidationTextRange; + } + public boolean namespaceTouches(int pos) { return this.textRangeTouches(this.namespaceTextRange, pos); } |