diff options
author | Paul Fullbright | 2013-04-29 20:05:02 +0000 |
---|---|---|
committer | Paul Fullbright | 2013-04-29 20:05:02 +0000 |
commit | 345c147cb96b286aac78f2345d85ec8c7ccf0e69 (patch) | |
tree | cbde11fb15f265b07b700fee0ddfac7fec49e5a2 /jaxb | |
parent | 66e5158236bb3e6db1d0e382abe854e2c5e9daec (diff) | |
download | webtools.dali-345c147cb96b286aac78f2345d85ec8c7ccf0e69.tar.gz webtools.dali-345c147cb96b286aac78f2345d85ec8c7ccf0e69.tar.xz webtools.dali-345c147cb96b286aac78f2345d85ec8c7ccf0e69.zip |
fixed jaxb content assist (bug 403390)v201304300138
Diffstat (limited to 'jaxb')
66 files changed, 923 insertions, 620 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/AbstractQName.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/AbstractQName.java index d26c6d9bd4..2fd1c31311 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/AbstractQName.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/AbstractQName.java @@ -237,12 +237,12 @@ public abstract class AbstractQName return (textRange != null) ? textRange : getParent().getValidationTextRange(); } - public TextRange getNamespaceTextRange() { - return getTextRange(this.proxy.getNamespaceTextRange()); + public TextRange getNamespaceValidationTextRange() { + return getTextRange(this.proxy.getNamespaceValidationTextRange()); } - public TextRange getNameTextRange() { - return getTextRange(this.proxy.getNameTextRange()); + public TextRange getNameValidationTextRange() { + return getTextRange(this.proxy.getNameValidationTextRange()); } /** @@ -268,7 +268,7 @@ public abstract class AbstractQName if (StringTools.isBlank(getName())) { messages.add( this.buildValidationMessage( - getNameTextRange(), + getNameValidationTextRange(), JptJaxbCoreValidationMessages.QNAME__MISSING_NAME, getReferencedComponentTypeDescription() ) @@ -280,7 +280,7 @@ public abstract class AbstractQName protected IMessage getUnresolveSchemaComponentMessage() { return this.buildValidationMessage( - getNameTextRange(), + getNameValidationTextRange(), JptJaxbCoreValidationMessages.QNAME__UNRESOLVED_COMPONENT, getReferencedComponentTypeDescription(), getNamespace(), @@ -297,7 +297,7 @@ public abstract class AbstractQName boolean namespaceTouches(int pos); - TextRange getNamespaceTextRange(); + TextRange getNamespaceValidationTextRange(); String getName(); @@ -305,6 +305,6 @@ public abstract class AbstractQName boolean nameTouches(int pos); - TextRange getNameTextRange(); + TextRange getNameValidationTextRange(); } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbClassMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbClassMapping.java index 75ff055277..ac0a39bc97 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbClassMapping.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbClassMapping.java @@ -9,7 +9,6 @@ ******************************************************************************/ package org.eclipse.jpt.jaxb.core.context; -import org.eclipse.jpt.common.utility.internal.transformer.AbstractTransformer; import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; import org.eclipse.jpt.common.utility.iterable.ListIterable; import org.eclipse.jpt.common.utility.transformer.Transformer; diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbQName.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbQName.java index 118ca41939..3e2740b150 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbQName.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbQName.java @@ -63,7 +63,7 @@ public interface JaxbQName // ***** validation ***** - TextRange getNamespaceTextRange(); + TextRange getNamespaceValidationTextRange(); - TextRange getNameTextRange(); + TextRange getNameValidationTextRange(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaTypeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaTypeMapping.java index 269a9d6e6a..c99567d63a 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaTypeMapping.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaTypeMapping.java @@ -458,7 +458,7 @@ public abstract class AbstractJavaTypeMapping buildDefaultNamespace())) { messages.add( this.buildValidationMessage( - getXmlTypeAnnotation().getNamespaceTextRange(), + getXmlTypeAnnotation().getNamespaceValidationTextRange(), JptJaxbCoreValidationMessages.XML_TYPE__UNMATCHING_NAMESPACE_FOR_ANONYMOUS_TYPE )); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractQNameAnnotationProxy.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractQNameAnnotationProxy.java index 79e6d0bdb9..f7a322bd4d 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractQNameAnnotationProxy.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractQNameAnnotationProxy.java @@ -35,9 +35,9 @@ public abstract class AbstractQNameAnnotationProxy return (annotation == null) ? false : annotation.namespaceTouches(pos); } - public TextRange getNamespaceTextRange() { + public TextRange getNamespaceValidationTextRange() { QNameAnnotation annotation = getAnnotation(false); - return (annotation == null) ? null : annotation.getNamespaceTextRange(); + return (annotation == null) ? null : annotation.getNamespaceValidationTextRange(); } public String getName() { @@ -54,8 +54,8 @@ public abstract class AbstractQNameAnnotationProxy return (annotation == null) ? false : annotation.nameTouches(pos); } - public TextRange getNameTextRange() { + public TextRange getNameValidationTextRange() { QNameAnnotation annotation = getAnnotation(false); - return (annotation == null) ? null : annotation.getNameTextRange(); + return (annotation == null) ? null : annotation.getNameValidationTextRange(); } }
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaElementFactoryMethod.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaElementFactoryMethod.java index 918c75dba8..93479a4b45 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaElementFactoryMethod.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaElementFactoryMethod.java @@ -389,7 +389,7 @@ public class GenericJavaElementFactoryMethod if ("".equals(getName())) { messages.add( this.buildValidationMessage( - getNameTextRange(), + getNameValidationTextRange(), JptJaxbCoreValidationMessages.QNAME__MISSING_NAME, getReferencedComponentTypeDescription())); } @@ -397,7 +397,7 @@ public class GenericJavaElementFactoryMethod if (ObjectTools.equals(getName(), GenericJavaElementFactoryMethod.this.getQName().getName())) { messages.add( this.buildValidationMessage( - getNameTextRange(), + getNameValidationTextRange(), JptJaxbCoreValidationMessages.XML_ELEMENT_DECL__SUBST_HEAD_NAME_EQUALS_NAME )); } @@ -450,9 +450,9 @@ public class GenericJavaElementFactoryMethod return (annotation == null) ? false : annotation.substitutionHeadNamespaceTouches(pos); } - public TextRange getNamespaceTextRange() { + public TextRange getNamespaceValidationTextRange() { XmlElementDeclAnnotation annotation = getAnnotation(); - return (annotation == null) ? null : annotation.getSubstitutionHeadNamespaceTextRange(); + return (annotation == null) ? null : annotation.getSubstitutionHeadNamespaceValidationTextRange(); } public String getName() { @@ -469,9 +469,9 @@ public class GenericJavaElementFactoryMethod return (annotation == null) ? false : annotation.substitutionHeadNameTouches(pos); } - public TextRange getNameTextRange() { + public TextRange getNameValidationTextRange() { XmlElementDeclAnnotation annotation = getAnnotation(); - return (annotation == null) ? null : annotation.getSubstitutionHeadNameTextRange(); + return (annotation == null) ? null : annotation.getSubstitutionHeadNameValidationTextRange(); } } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaJaxbClass.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaJaxbClass.java index a47117b7bd..29b23e16ba 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaJaxbClass.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaJaxbClass.java @@ -11,6 +11,8 @@ package org.eclipse.jpt.jaxb.core.internal.context.java; import java.util.List; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; +import org.eclipse.jpt.common.utility.internal.iterable.EmptyIterable; +import org.eclipse.jpt.common.utility.internal.iterable.IterableTools; import org.eclipse.jpt.jaxb.core.context.JaxbContextNode; import org.eclipse.jpt.jaxb.core.context.TypeKind; import org.eclipse.jpt.jaxb.core.context.XmlRegistry; @@ -127,6 +129,27 @@ public class GenericJavaJaxbClass } + // ***** content assist ***** + + @Override + public Iterable<String> getCompletionProposals(int pos) { + + Iterable<String> result = super.getCompletionProposals(pos); + if (! IterableTools.isEmpty(result)) { + return result; + } + + if (this.xmlRegistry != null) { + result = this.xmlRegistry.getCompletionProposals(pos); + if (! IterableTools.isEmpty(result)) { + return result; + } + } + + return EmptyIterable.instance(); + } + + // ***** validation ***** @Override diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java index 81fa3fe6a7..c79c0fd650 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java @@ -214,7 +214,7 @@ public class GenericJavaXmlAttributeMapping if (! xsdFeature.typeIsValid(expectedSchemaType, isItemType)) { messages.add( this.buildValidationMessage( - this.qName.getNameTextRange(), + this.qName.getNameValidationTextRange(), JptJaxbCoreValidationMessages.XML_ATTRIBUTE__INVALID_SCHEMA_TYPE, getValueTypeName(), xsdFeature.getName())); @@ -304,7 +304,7 @@ public class GenericJavaXmlAttributeMapping return GenericJavaXmlAttributeMapping.this.getPersistentAttribute().getJavaResourceAttributeBaseTypeName(); } - public TextRange getTypeTextRange() { + public TextRange getTypeValidationTextRange() { // 1) if we're getting here, XmlIDREF will not be null // 2) use the @XmlIDREF text range, since there is no specific place where the type is specified return GenericJavaXmlAttributeMapping.this.getXmlIDREF().getValidationTextRange(); @@ -314,8 +314,8 @@ public class GenericJavaXmlAttributeMapping return GenericJavaXmlAttributeMapping.this.getXsdFeature(); } - public TextRange getXsdFeatureTextRange() { - return GenericJavaXmlAttributeMapping.this.getQName().getNameTextRange(); + public TextRange getXsdFeatureValidationTextRange() { + return GenericJavaXmlAttributeMapping.this.getQName().getNameValidationTextRange(); } }); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElement.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElement.java index 27853d4f61..36671dfbd2 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElement.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElement.java @@ -10,8 +10,8 @@ package org.eclipse.jpt.jaxb.core.internal.context.java; import java.util.List; -import org.eclipse.jpt.common.core.internal.utility.TypeTools; import org.eclipse.jpt.common.core.internal.utility.JavaProjectTools; +import org.eclipse.jpt.common.core.internal.utility.TypeTools; import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterable.EmptyIterable; @@ -426,7 +426,7 @@ public class GenericJavaXmlElement if (! xsdElement.typeIsValid(expectedSchemaType, this.context.hasXmlList())) { messages.add( this.buildValidationMessage( - this.qName.getNameTextRange(), + this.qName.getNameValidationTextRange(), JptJaxbCoreValidationMessages.XML_ELEMENT__INVALID_SCHEMA_TYPE, typeName, xsdElement.getName())); diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java index d01f16ca78..363ca6ba74 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java @@ -292,7 +292,7 @@ public class GenericJavaXmlElementMapping return GenericJavaXmlElementMapping.this.xmlElement.getType(); } - public TextRange getTypeTextRange() { + public TextRange getTypeValidationTextRange() { // 1) if we're getting here, XmlIDREF will not be null // 2) if there is an @XmlElement annotation, use that, otherwise use the @XmlIDREF return (GenericJavaXmlElementMapping.this.getAnnotation() == null) ? @@ -304,8 +304,8 @@ public class GenericJavaXmlElementMapping return GenericJavaXmlElementMapping.this.getXsdFeature(); } - public TextRange getXsdFeatureTextRange() { - return GenericJavaXmlElementMapping.this.xmlElement.getQName().getNameTextRange(); + public TextRange getXsdFeatureValidationTextRange() { + return GenericJavaXmlElementMapping.this.xmlElement.getQName().getNameValidationTextRange(); } }); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefs.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefs.java index 5d503cd28f..49611e3185 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefs.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRefs.java @@ -176,7 +176,7 @@ public class GenericJavaXmlElementRefs messages.add( this.buildValidationMessage( xmlElementRef, - xmlElementRef.getQName().getNameTextRange(), + xmlElementRef.getQName().getNameValidationTextRange(), JptJaxbCoreValidationMessages.XML_ELEMENT_REFS__DUPLICATE_XML_ELEMENT_QNAME, xmlElementName)); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementsMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementsMapping.java index 76acda46dc..d9600d13ec 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementsMapping.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementsMapping.java @@ -369,7 +369,7 @@ public class GenericJavaXmlElementsMapping messages.add( this.buildValidationMessage( xmlElement, - xmlElement.getQName().getNameTextRange(), + xmlElement.getQName().getNameValidationTextRange(), JptJaxbCoreValidationMessages.XML_ELEMENTS__DUPLICATE_XML_ELEMENT_QNAME, xmlElementName)); } @@ -475,8 +475,7 @@ public class GenericJavaXmlElementsMapping } public static class XmlElementValidatableReference - implements ValidatableReference - { + implements ValidatableReference { protected final XmlElement xmlElement; public XmlElementValidatableReference(XmlElement xmlElement) { super(); @@ -486,7 +485,7 @@ public class GenericJavaXmlElementsMapping return this.xmlElement.getFullyQualifiedType(); } - public TextRange getTypeTextRange() { + public TextRange getTypeValidationTextRange() { return this.xmlElement.getTypeTextRange(); } @@ -494,8 +493,8 @@ public class GenericJavaXmlElementsMapping return this.xmlElement.getXsdElement(); } - public TextRange getXsdFeatureTextRange() { - return this.xmlElement.getQName().getNameTextRange(); + public TextRange getXsdFeatureValidationTextRange() { + return this.xmlElement.getQName().getNameValidationTextRange(); } } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlIDREF.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlIDREF.java index e877544b12..b4d863b001 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlIDREF.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlIDREF.java @@ -67,7 +67,7 @@ public class GenericJavaXmlIDREF if (classMapping == null || classMapping.getXmlIdMapping() == null) { messages.add( this.buildValidationMessage( - ref.getTypeTextRange(), + ref.getTypeValidationTextRange(), JptJaxbCoreValidationMessages.XML_ID_REF__TYPE_DOES_NOT_CONTAIN_XML_ID, typeName)); } @@ -81,7 +81,7 @@ public class GenericJavaXmlIDREF && ! xsdFeature.typeIsValid(XsdUtil.getSchemaForSchema().getTypeDefinition("IDREF"), this.context.isList())) { messages.add( this.buildValidationMessage( - ref.getXsdFeatureTextRange(), + ref.getXsdFeatureValidationTextRange(), JptJaxbCoreValidationMessages.XML_ID_REF__SCHEMA_TYPE_NOT_IDREF, xsdFeature.getName())); } @@ -103,10 +103,10 @@ public class GenericJavaXmlIDREF String getFullyQualifiedType(); - TextRange getTypeTextRange(); + TextRange getTypeValidationTextRange(); XsdFeature getXsdFeature(); - TextRange getXsdFeatureTextRange(); + TextRange getXsdFeatureValidationTextRange(); } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlRegistry.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlRegistry.java index 7797378392..7e4325089f 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlRegistry.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlRegistry.java @@ -203,7 +203,7 @@ public class GenericJavaXmlRegistry messages.add( this.buildValidationMessage( xmlElementDecl, - xmlElementDecl.getQName().getNameTextRange(), + xmlElementDecl.getQName().getNameValidationTextRange(), JptJaxbCoreValidationMessages.XML_REGISTRY__DUPLICATE_XML_ELEMENT_QNAME, xmlElementName, scopeDesc)); diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumAnnotation.java index a8a2936c31..923b434fbb 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumAnnotation.java @@ -51,4 +51,8 @@ public final class NullXmlEnumAnnotation public TextRange getValueTextRange() { return null; } + + public TextRange getValueValidationTextRange() { + 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 c188ea69a6..34093ff86f 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 @@ -47,6 +47,10 @@ public final class NullXmlEnumValueAnnotation public TextRange getValueTextRange() { return null; } + + public TextRange getValueValidationTextRange() { + return null; + } public boolean valueTouches(int pos) { return false; diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlTypeAnnotation.java index c649cbd58e..9e45242726 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlTypeAnnotation.java @@ -84,6 +84,10 @@ public final class NullXmlTypeAnnotation return null; } + public TextRange getNameValidationTextRange() { + return null; + } + public boolean nameTouches(int pos) { return false; } @@ -104,6 +108,10 @@ public final class NullXmlTypeAnnotation return null; } + public TextRange getNamespaceValidationTextRange() { + return null; + } + public boolean namespaceTouches(int pos) { return false; } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryQNameAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryQNameAnnotation.java new file mode 100644 index 0000000000..757e466845 --- /dev/null +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryQNameAnnotation.java @@ -0,0 +1,63 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; + +import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceModel;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jaxb.core.resource.java.QNameAnnotation;
+ +public abstract class BinaryQNameAnnotation
+ extends BinaryAnnotation + implements QNameAnnotation {
+
+ public BinaryQNameAnnotation(JavaResourceModel parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+
+ // ***** name
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ public TextRange getNameTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+ public TextRange getNameValidationTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean nameTouches(int pos) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ***** namespace
+
+ public void setNamespace(String namespace) {
+ throw new UnsupportedOperationException();
+ }
+
+ public TextRange getNamespaceTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+ public TextRange getNamespaceValidationTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean namespaceTouches(int pos) {
+ throw new UnsupportedOperationException();
+ } +} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttributeAnnotation.java index 14fa07cd03..ba8f82a591 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttributeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttributeAnnotation.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; -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; import org.eclipse.jpt.jaxb.core.resource.java.JAXB; @@ -20,25 +19,25 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; * javax.xml.bind.annotation.XmlAttribute */ public final class BinaryXmlAttributeAnnotation - extends BinaryAnnotation - implements XmlAttributeAnnotation -{ + extends BinaryQNameAnnotation + implements XmlAttributeAnnotation { + private String name; private String namespace; private Boolean required; - - + + public BinaryXmlAttributeAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { super(parent, jdtAnnotation); this.name = this.buildName(); this.namespace = this.buildNamespace(); this.required = this.buildRequired(); } - + public String getAnnotationName() { return JAXB.XML_ATTRIBUTE; } - + @Override public void update() { super.update(); @@ -58,56 +57,32 @@ public final class BinaryXmlAttributeAnnotation public String getName() { return this.name; } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - + private void setName_(String name) { String old = this.name; this.name = name; this.firePropertyChanged(NAME_PROPERTY, old, name); } - + private String buildName() { return (String) this.getJdtMemberValue(JAXB.XML_ATTRIBUTE__NAME); } - - public TextRange getNameTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos) { - throw new UnsupportedOperationException(); - } // ***** namespace public String getNamespace() { return this.namespace; } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - + private void setNamespace_(String namespace) { String old = this.namespace; this.namespace = namespace; this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); } - + private String buildNamespace() { return (String) this.getJdtMemberValue(JAXB.XML_ATTRIBUTE__NAMESPACE); } - - public TextRange getNamespaceTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean namespaceTouches(int pos) { - throw new UnsupportedOperationException(); - } // ***** required diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java index ae47276fdd..ceaa20e81b 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; import org.eclipse.jpt.common.core.resource.java.JavaResourceModel; import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jaxb.core.resource.java.JAXB; @@ -20,9 +19,9 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; * javax.xml.bind.annotation.XmlElement */ public final class BinaryXmlElementAnnotation - extends BinaryAnnotation - implements XmlElementAnnotation -{ + extends BinaryQNameAnnotation + implements XmlElementAnnotation { + private String name; private String namespace; private String defaultValue; @@ -67,56 +66,32 @@ public final class BinaryXmlElementAnnotation public String getName() { return this.name; } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - + private void setName_(String name) { String old = this.name; this.name = name; this.firePropertyChanged(NAME_PROPERTY, old, name); } - + private String buildName() { return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__NAME); } - - public TextRange getNameTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos) { - throw new UnsupportedOperationException(); - } // ***** namespace public String getNamespace() { return this.namespace; } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - + private void setNamespace_(String namespace) { String old = this.namespace; this.namespace = namespace; this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); } - + private String buildNamespace() { return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__NAMESPACE); } - - public TextRange getNamespaceTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean namespaceTouches(int pos) { - throw new UnsupportedOperationException(); - } // ***** default value diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementDeclAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementDeclAnnotation.java index 86951d8798..2b95dfa702 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementDeclAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementDeclAnnotation.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; -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; import org.eclipse.jpt.jaxb.core.resource.java.JAXB; @@ -20,7 +19,7 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; * javax.xml.bind.annotation.XmlElementDecl */ public final class BinaryXmlElementDeclAnnotation - extends BinaryAnnotation + extends BinaryQNameAnnotation implements XmlElementDeclAnnotation { private String scope; @@ -69,10 +68,6 @@ public final class BinaryXmlElementDeclAnnotation return this.namespace; } - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - private void setNamespace_(String namespace) { String old = this.namespace; this.namespace = namespace; @@ -83,14 +78,6 @@ public final class BinaryXmlElementDeclAnnotation return (String) getJdtMemberValue(JAXB.XML_ELEMENT_DECL__NAMESPACE); } - public TextRange getNamespaceTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean namespaceTouches(int pos) { - throw new UnsupportedOperationException(); - } - // ***** name ***** @@ -98,10 +85,6 @@ public final class BinaryXmlElementDeclAnnotation return this.name; } - public void setName(String name) { - throw new UnsupportedOperationException(); - } - private void setName_(String name) { String old = this.name; this.name = name; @@ -112,14 +95,6 @@ public final class BinaryXmlElementDeclAnnotation return (String) getJdtMemberValue(JAXB.XML_ELEMENT_DECL__NAME); } - public TextRange getNameTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos) { - throw new UnsupportedOperationException(); - } - // ***** scope ***** @@ -175,6 +150,10 @@ public final class BinaryXmlElementDeclAnnotation throw new UnsupportedOperationException(); } + public TextRange getSubstitutionHeadNamespaceValidationTextRange() { + throw new UnsupportedOperationException(); + } + public boolean substitutionHeadNamespaceTouches(int pos) { throw new UnsupportedOperationException(); } @@ -204,6 +183,10 @@ public final class BinaryXmlElementDeclAnnotation throw new UnsupportedOperationException(); } + public TextRange getSubstitutionHeadNameValidationTextRange() { + throw new UnsupportedOperationException(); + } + public boolean substitutionHeadNameTouches(int pos) { throw new UnsupportedOperationException(); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java index b8b09a2a4f..3ff626bbf0 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; import org.eclipse.jpt.common.core.resource.java.JavaResourceModel; import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jaxb.core.resource.java.JAXB; @@ -20,9 +19,9 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation; * javax.xml.bind.annotation.XmlElementRef */ public final class BinaryXmlElementRefAnnotation - extends BinaryAnnotation - implements XmlElementRefAnnotation -{ + extends BinaryQNameAnnotation + implements XmlElementRefAnnotation { + private String name; private String namespace; private Boolean required; @@ -61,56 +60,34 @@ public final class BinaryXmlElementRefAnnotation public String getName() { return this.name; } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - + private void setName_(String name) { String old = this.name; this.name = name; this.firePropertyChanged(NAME_PROPERTY, old, name); } - + private String buildName() { return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_REF__NAME); } - - public TextRange getNameTextRange() { - throw new UnsupportedOperationException(); - } - public boolean nameTouches(int pos) { - throw new UnsupportedOperationException(); - } - + // ***** namespace public String getNamespace() { return this.namespace; } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - + private void setNamespace_(String namespace) { String old = this.namespace; this.namespace = namespace; this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); } - + private String buildNamespace() { return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_REF__NAMESPACE); } - - public TextRange getNamespaceTextRange() { - throw new UnsupportedOperationException(); - } - public boolean namespaceTouches(int pos) { - throw new UnsupportedOperationException(); - } - + // ***** required public Boolean getRequired() { return this.required; @@ -162,5 +139,4 @@ public final class BinaryXmlElementRefAnnotation public String getFullyQualifiedTypeName() { return this.type; } - } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementWrapperAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementWrapperAnnotation.java index 41058a2631..bc16de5f16 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementWrapperAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementWrapperAnnotation.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; -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; import org.eclipse.jpt.jaxb.core.resource.java.JAXB; @@ -20,9 +19,9 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; * javax.xml.bind.annotation.XmlElementWrapper */ public final class BinaryXmlElementWrapperAnnotation - extends BinaryAnnotation - implements XmlElementWrapperAnnotation -{ + extends BinaryQNameAnnotation + implements XmlElementWrapperAnnotation { + private String name; private String namespace; private Boolean nillable; @@ -61,56 +60,32 @@ public final class BinaryXmlElementWrapperAnnotation public String getName() { return this.name; } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - + private void setName_(String name) { String old = this.name; this.name = name; this.firePropertyChanged(NAME_PROPERTY, old, name); } - + private String buildName() { return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_WRAPPER__NAME); } - - public TextRange getNameTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos) { - throw new UnsupportedOperationException(); - } // ***** namespace public String getNamespace() { return this.namespace; } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - + private void setNamespace_(String namespace) { String old = this.namespace; this.namespace = namespace; this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); } - + private String buildNamespace() { return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_WRAPPER__NAMESPACE); } - - public TextRange getNamespaceTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean namespaceTouches(int pos) { - throw new UnsupportedOperationException(); - } // ***** nillable diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java index 04cbd31e13..6c6a24a5e4 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java @@ -23,9 +23,9 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation; * javax.xml.bind.annotation.XmlElements */ public final class BinaryXmlElementsAnnotation - extends BinaryAnnotation - implements XmlElementsAnnotation -{ + extends BinaryAnnotation + implements XmlElementsAnnotation { + private final Vector<XmlElementAnnotation> xmlElements; diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumAnnotation.java index cbf67137e2..d160b4ec1c 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumAnnotation.java @@ -73,6 +73,10 @@ public final class BinaryXmlEnumAnnotation throw new UnsupportedOperationException(); } + public TextRange getValueValidationTextRange() { + throw new UnsupportedOperationException(); + } + // ***** fully-qualified value class name public String getFullyQualifiedValueClassName() { return this.value; 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 fd7da5d7e2..823c57eb04 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 @@ -65,6 +65,10 @@ public final class BinaryXmlEnumValueAnnotation public TextRange getValueTextRange() { throw new UnsupportedOperationException(); } + + public TextRange getValueValidationTextRange() { + throw new UnsupportedOperationException(); + } public boolean valueTouches(int pos) { throw new UnsupportedOperationException(); diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRootElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRootElementAnnotation.java index 4c80708972..ff1c925a15 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRootElementAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRootElementAnnotation.java @@ -10,9 +10,7 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; -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; import org.eclipse.jpt.jaxb.core.resource.java.JAXB; import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; @@ -20,9 +18,9 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; * javax.xml.bind.annotation.XmlRootElement */ public final class BinaryXmlRootElementAnnotation - extends BinaryAnnotation - implements XmlRootElementAnnotation -{ + extends BinaryQNameAnnotation + implements XmlRootElementAnnotation { + private String name; private String namespace; @@ -32,7 +30,8 @@ public final class BinaryXmlRootElementAnnotation this.name = this.buildName(); this.namespace = this.buildNamespace(); } - + + public String getAnnotationName() { return JAXB.XML_ROOT_ELEMENT; } @@ -56,54 +55,30 @@ public final class BinaryXmlRootElementAnnotation public String getName() { return this.name; } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - + private void setName_(String name) { String old = this.name; this.name = name; this.firePropertyChanged(NAME_PROPERTY, old, name); } - + private String buildName() { return (String) this.getJdtMemberValue(JAXB.XML_ROOT_ELEMENT__NAME); } - - public TextRange getNameTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos) { - throw new UnsupportedOperationException(); - } // ***** namespace public String getNamespace() { return this.namespace; } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - + private void setNamespace_(String namespace) { String old = this.namespace; this.namespace = namespace; this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); } - + private String buildNamespace() { return (String) this.getJdtMemberValue(JAXB.XML_ROOT_ELEMENT__NAMESPACE); } - - public TextRange getNamespaceTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean namespaceTouches(int pos) { - throw new UnsupportedOperationException(); - } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSchemaTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSchemaTypeAnnotation.java index 4cd33fb8a1..ffd49290c9 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSchemaTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSchemaTypeAnnotation.java @@ -12,7 +12,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; import org.eclipse.jpt.common.core.internal.utility.TypeTools; import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; import org.eclipse.jpt.common.core.utility.TextRange; @@ -23,7 +22,7 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; * javax.xml.bind.annotation.XmlSchemaType */ public class BinaryXmlSchemaTypeAnnotation - extends BinaryAnnotation + extends BinaryQNameAnnotation implements XmlSchemaTypeAnnotation { private String name; @@ -60,44 +59,19 @@ public class BinaryXmlSchemaTypeAnnotation public String getName() { return this.name; } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - private String buildName() { return (String) this.getJdtMemberValue(JAXB.XML_SCHEMA_TYPE__NAME); } - - public TextRange getNameTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos) { - throw new UnsupportedOperationException(); - } // ***** namespace public String getNamespace() { return this.namespace; } - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - private String buildNamespace() { return (String) this.getJdtMemberValue(JAXB.XML_SCHEMA_TYPE__NAMESPACE); } - public TextRange getNamespaceTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean namespaceTouches(int pos) { - throw new UnsupportedOperationException(); - } - // ***** type public String getType() { return this.type; @@ -122,5 +96,4 @@ public class BinaryXmlSchemaTypeAnnotation private String buildFullyQualifiedType(IAnnotation jdtAnnotation) { return TypeTools.resolveType((IType)jdtAnnotation.getAncestor(IJavaElement.TYPE), this.type); } - } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTypeAnnotation.java index 32195d1a6d..9ffbaa73e0 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTypeAnnotation.java @@ -11,7 +11,6 @@ package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; import java.util.Vector; import org.eclipse.jdt.core.IAnnotation; -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; import org.eclipse.jpt.common.utility.internal.iterable.IterableTools; @@ -23,9 +22,9 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; * javax.xml.bind.annotation.XmlType */ public final class BinaryXmlTypeAnnotation - extends BinaryAnnotation - implements XmlTypeAnnotation -{ + extends BinaryQNameAnnotation + implements XmlTypeAnnotation { + private String factoryClass; private String factoryMethod; private String name; @@ -119,11 +118,7 @@ public final class BinaryXmlTypeAnnotation public String getName() { return this.name; } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - + private void setName_(String name) { String old = this.name; this.name = name; @@ -134,41 +129,21 @@ public final class BinaryXmlTypeAnnotation return (String) this.getJdtMemberValue(JAXB.XML_TYPE__NAME); } - public TextRange getNameTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos) { - throw new UnsupportedOperationException(); - } - // ***** namespace public String getNamespace() { return this.namespace; } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - + private void setNamespace_(String namespace) { String old = this.namespace; this.namespace = namespace; this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); } - + private String buildNamespace() { return (String) this.getJdtMemberValue(JAXB.XML_TYPE__NAMESPACE); } - - public TextRange getNamespaceTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean namespaceTouches(int pos) { - throw new UnsupportedOperationException(); - } // ***** prop order 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 763e03fb7f..b2c85687d9 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 @@ -29,27 +29,29 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; * javax.xml.bind.annotation.XmlAttribute */ public final class SourceXmlAttributeAnnotation - extends SourceAnnotation - implements XmlAttributeAnnotation -{ + extends SourceAnnotation + implements XmlAttributeAnnotation { + public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_ATTRIBUTE); private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; 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> requiredDeclarationAdapter; private final AnnotationElementAdapter<Boolean> requiredAdapter; private Boolean required; private TextRange requiredTextRange; - - + + // ********** constructors ********** public SourceXmlAttributeAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { this(parent, annotatedElement, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(annotatedElement, DECLARATION_ANNOTATION_ADAPTER)); @@ -92,23 +94,27 @@ public final class SourceXmlAttributeAnnotation @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.required = this.buildRequired(astAnnotation); - this.requiredTextRange = this.buildRequiredTextRange(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.required = buildRequired(astAnnotation); + this.requiredTextRange = 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); + syncName(buildName(astAnnotation)); + this.nameTextRange = buildNameTextRange(astAnnotation); + this.nameValidationTextRange = buildNameValidationTextRange(astAnnotation); + this.syncNamespace(buildNamespace(astAnnotation)); + this.namespaceTextRange = buildNamespaceTextRange(astAnnotation); + this.namespaceValidationTextRange = buildNamespaceValidationTextRange(astAnnotation); + this.syncRequired(buildRequired(astAnnotation)); + this.requiredTextRange = buildRequiredTextRange(astAnnotation); } @Override @@ -140,15 +146,23 @@ public final class SourceXmlAttributeAnnotation 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); } @@ -175,15 +189,23 @@ public final class SourceXmlAttributeAnnotation 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); } 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); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementDeclAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementDeclAnnotation.java index 75347699c4..f8bec90510 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementDeclAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementDeclAnnotation.java @@ -46,21 +46,25 @@ public final class SourceXmlElementDeclAnnotation private final AnnotationElementAdapter<String> namespaceAdapter; private String namespace; private TextRange namespaceTextRange; + private TextRange namespaceValidationTextRange; private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; private final AnnotationElementAdapter<String> nameAdapter; private String name; private TextRange nameTextRange; + private TextRange nameValidationTextRange; private final DeclarationAnnotationElementAdapter<String> substitutionHeadNamespaceDeclarationAdapter; private final AnnotationElementAdapter<String> substitutionHeadNamespaceAdapter; private String substitutionHeadNamespace; private TextRange substitutionHeadNamespaceTextRange; + private TextRange substitutionHeadNamespaceValidationTextRange; private final DeclarationAnnotationElementAdapter<String> substitutionHeadNameDeclarationAdapter; private final AnnotationElementAdapter<String> substitutionHeadNameAdapter; private String substitutionHeadName; private TextRange substitutionHeadNameTextRange; + private TextRange substitutionHeadNameValidationTextRange; private final DeclarationAnnotationElementAdapter<String> defaultValueDeclarationAdapter; private final AnnotationElementAdapter<String> defaultValueAdapter; @@ -127,36 +131,44 @@ public final class SourceXmlElementDeclAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.scope = buildScope(astAnnotation); - this.scopeTextRange = this.buildScopeTextRange(astAnnotation); + this.scopeTextRange = buildScopeTextRange(astAnnotation); this.fullyQualifiedScopeClassName = buildFullyQualifiedScopeClassName(astAnnotation); this.namespace = buildNamespace(astAnnotation); - this.namespaceTextRange = this.buildNamespaceTextRange(astAnnotation); + this.namespaceTextRange = buildNamespaceTextRange(astAnnotation); + this.namespaceValidationTextRange = buildNamespaceValidationTextRange(astAnnotation); this.name = buildName(astAnnotation); - this.nameTextRange = this.buildNameTextRange(astAnnotation); + this.nameTextRange = buildNameTextRange(astAnnotation); + this.nameValidationTextRange = buildNameValidationTextRange(astAnnotation); this.substitutionHeadNamespace = buildSubstitutionHeadNamespace(astAnnotation); - this.substitutionHeadNamespaceTextRange = this.buildSubstitutionHeadNamespaceTextRange(astAnnotation); + this.substitutionHeadNamespaceTextRange = buildSubstitutionHeadNamespaceTextRange(astAnnotation); + this.substitutionHeadNamespaceValidationTextRange = buildSubstitutionHeadNamespaceValidationTextRange(astAnnotation); this.substitutionHeadName = buildSubstitutionHeadName(astAnnotation); - this.substitutionHeadNameTextRange = this.buildSubstitutionHeadNameTextRange(astAnnotation); + this.substitutionHeadNameTextRange = buildSubstitutionHeadNameTextRange(astAnnotation); + this.substitutionHeadNameValidationTextRange = buildSubstitutionHeadNameValidationTextRange(astAnnotation); this.defaultValue = buildDefaultValue(astAnnotation); - this.defaultValueTextRange = this.buildDefaultValueTextRange(astAnnotation); + this.defaultValueTextRange = buildDefaultValueTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); syncScope(buildScope(astAnnotation)); - this.scopeTextRange = this.buildScopeTextRange(astAnnotation); + this.scopeTextRange = buildScopeTextRange(astAnnotation); syncFullyQualifiedScopeClassName(buildFullyQualifiedScopeClassName(astAnnotation)); syncNamespace(buildNamespace(astAnnotation)); - this.namespaceTextRange = this.buildNamespaceTextRange(astAnnotation); + this.namespaceTextRange = buildNamespaceTextRange(astAnnotation); + this.namespaceValidationTextRange = buildNamespaceValidationTextRange(astAnnotation); syncName(buildName(astAnnotation)); - this.nameTextRange = this.buildNameTextRange(astAnnotation); + this.nameTextRange = buildNameTextRange(astAnnotation); + this.nameValidationTextRange = buildNameValidationTextRange(astAnnotation); syncSubstitutionHeadNamespace(buildSubstitutionHeadNamespace(astAnnotation)); - this.substitutionHeadNamespaceTextRange = this.buildSubstitutionHeadNamespaceTextRange(astAnnotation); + this.substitutionHeadNamespaceTextRange = buildSubstitutionHeadNamespaceTextRange(astAnnotation); + this.substitutionHeadNamespaceValidationTextRange = buildSubstitutionHeadNamespaceValidationTextRange(astAnnotation); syncSubstitutionHeadName(buildSubstitutionHeadName(astAnnotation)); - this.substitutionHeadNameTextRange = this.buildSubstitutionHeadNameTextRange(astAnnotation); + this.substitutionHeadNameTextRange = buildSubstitutionHeadNameTextRange(astAnnotation); + this.substitutionHeadNameValidationTextRange = buildSubstitutionHeadNameValidationTextRange(astAnnotation); syncDefaultValue(buildDefaultValue(astAnnotation)); - this.defaultValueTextRange = this.buildDefaultValueTextRange(astAnnotation); + this.defaultValueTextRange = buildDefaultValueTextRange(astAnnotation); } @Override @@ -236,15 +248,23 @@ public final class SourceXmlElementDeclAnnotation 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); } @@ -273,15 +293,22 @@ public final class SourceXmlElementDeclAnnotation 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); } @@ -309,15 +336,23 @@ public final class SourceXmlElementDeclAnnotation private String buildSubstitutionHeadNamespace(Annotation astAnnotation) { return this.substitutionHeadNamespaceAdapter.getValue(astAnnotation); } - + private TextRange buildSubstitutionHeadNamespaceTextRange(Annotation astAnnotation) { - return this.getElementTextRange(this.substitutionHeadNamespaceDeclarationAdapter, astAnnotation); + return getAnnotationElementTextRange(this.substitutionHeadNamespaceDeclarationAdapter, astAnnotation); } - + + private TextRange buildSubstitutionHeadNamespaceValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(this.substitutionHeadNamespaceDeclarationAdapter, astAnnotation); + } + public TextRange getSubstitutionHeadNamespaceTextRange() { return this.substitutionHeadNamespaceTextRange; } + public TextRange getSubstitutionHeadNamespaceValidationTextRange() { + return this.substitutionHeadNamespaceValidationTextRange; + } + public boolean substitutionHeadNamespaceTouches(int pos) { return this.textRangeTouches(this.substitutionHeadNamespaceTextRange, pos); } @@ -345,15 +380,23 @@ public final class SourceXmlElementDeclAnnotation private String buildSubstitutionHeadName(Annotation astAnnotation) { return this.substitutionHeadNameAdapter.getValue(astAnnotation); } - + private TextRange buildSubstitutionHeadNameTextRange(Annotation astAnnotation) { - return this.getElementTextRange(this.substitutionHeadNameDeclarationAdapter, astAnnotation); + return getAnnotationElementTextRange(this.substitutionHeadNameDeclarationAdapter, astAnnotation); } - + + private TextRange buildSubstitutionHeadNameValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(this.substitutionHeadNameDeclarationAdapter, astAnnotation); + } + public TextRange getSubstitutionHeadNameTextRange() { return this.substitutionHeadNameTextRange; } + public TextRange getSubstitutionHeadNameValidationTextRange() { + return this.substitutionHeadNameValidationTextRange; + } + public boolean substitutionHeadNameTouches(int pos) { return this.textRangeTouches(this.substitutionHeadNameTextRange, pos); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java index 0636216de9..81b7d838a9 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java @@ -48,11 +48,13 @@ public final class SourceXmlElementRefAnnotation 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> requiredDeclarationAdapter; private final AnnotationElementAdapter<Boolean> requiredAdapter; @@ -150,29 +152,33 @@ public final class SourceXmlElementRefAnnotation @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.required = this.buildRequired(astAnnotation); - this.requiredTextRange = this.buildRequiredTextRange(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.required = buildRequired(astAnnotation); + this.requiredTextRange = buildRequiredTextRange(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.syncRequired(this.buildRequired(astAnnotation)); - this.requiredTextRange = this.buildRequiredTextRange(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.syncRequired(buildRequired(astAnnotation)); + this.requiredTextRange = buildRequiredTextRange(astAnnotation); + this.syncType(buildType(astAnnotation)); + this.syncFullyQualifiedTypeName(buildFullyQualifiedTypeName(astAnnotation)); + this.typeTextRange = buildTypeTextRange(astAnnotation); } @Override @@ -204,15 +210,23 @@ public final class SourceXmlElementRefAnnotation 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); } @@ -239,15 +253,23 @@ public final class SourceXmlElementRefAnnotation 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); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementWrapperAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementWrapperAnnotation.java index 9b95f16cf9..d935d790d4 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementWrapperAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementWrapperAnnotation.java @@ -29,32 +29,34 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; * javax.xml.bind.annotation.XmlElementWrapper */ public final class SourceXmlElementWrapperAnnotation - extends SourceAnnotation - implements XmlElementWrapperAnnotation -{ + extends SourceAnnotation + implements XmlElementWrapperAnnotation { + public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_ELEMENT_WRAPPER); private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; 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; private Boolean nillable; private TextRange nillableTextRange; - + private final DeclarationAnnotationElementAdapter<Boolean> requiredDeclarationAdapter; private final AnnotationElementAdapter<Boolean> requiredAdapter; private Boolean required; private TextRange requiredTextRange; - - + + // ********** constructors ********** public SourceXmlElementWrapperAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { this(parent, annotatedElement, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(annotatedElement, DECLARATION_ANNOTATION_ADAPTER)); @@ -103,27 +105,31 @@ public final class SourceXmlElementWrapperAnnotation @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.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); } @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); + syncName(buildName(astAnnotation)); + this.nameTextRange = buildNameTextRange(astAnnotation); + this.nameValidationTextRange = buildNameValidationTextRange(astAnnotation); + syncNamespace(buildNamespace(astAnnotation)); + this.namespaceTextRange = buildNamespaceTextRange(astAnnotation); + this.namespaceValidationTextRange = buildNamespaceValidationTextRange(astAnnotation); + syncNillable(buildNillable(astAnnotation)); + this.nillableTextRange = buildNillableTextRange(astAnnotation); + syncRequired(buildRequired(astAnnotation)); + this.requiredTextRange = buildRequiredTextRange(astAnnotation); } @Override @@ -155,15 +161,23 @@ public final class SourceXmlElementWrapperAnnotation 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); } @@ -190,15 +204,23 @@ public final class SourceXmlElementWrapperAnnotation 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); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumAnnotation.java index 2bc18b5321..42071e31a1 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumAnnotation.java @@ -30,15 +30,16 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; * javax.xml.bind.annotation.XmlEnum */ public final class SourceXmlEnumAnnotation - extends SourceAnnotation - implements XmlEnumAnnotation -{ + extends SourceAnnotation + implements XmlEnumAnnotation { + public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_ENUM); private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); private final AnnotationElementAdapter<String> valueAdapter; private String value; private TextRange valueTextRange; + private TextRange valueValidationTextRange; private String fullyQualifiedValueClassName; @@ -58,17 +59,19 @@ public final class SourceXmlEnumAnnotation @Override public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); - this.value = this.buildValue(astAnnotation); - this.valueTextRange = this.buildValueTextRange(astAnnotation); - this.fullyQualifiedValueClassName = this.buildFullyQualifiedValueClassName(astAnnotation); + this.value = buildValue(astAnnotation); + this.valueTextRange = buildValueTextRange(astAnnotation); + this.valueValidationTextRange = buildValueValidationTextRange(astAnnotation); + this.fullyQualifiedValueClassName = buildFullyQualifiedValueClassName(astAnnotation); } - + @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); - this.syncValue(this.buildValue(astAnnotation)); - this.valueTextRange = this.buildValueTextRange(astAnnotation); - this.syncFullyQualifiedValueClassName(this.buildFullyQualifiedValueClassName(astAnnotation)); + syncValue(buildValue(astAnnotation)); + this.valueTextRange = buildValueTextRange(astAnnotation); + this.valueValidationTextRange = buildValueValidationTextRange(astAnnotation); + syncFullyQualifiedValueClassName(buildFullyQualifiedValueClassName(astAnnotation)); } @Override @@ -100,41 +103,49 @@ public final class SourceXmlEnumAnnotation private String buildValue(Annotation astAnnotation) { return this.valueAdapter.getValue(astAnnotation); } - + + private TextRange buildValueTextRange(Annotation astAnnotation) { + return getAnnotationElementTextRange(VALUE_ADAPTER, astAnnotation); + } + + private TextRange buildValueValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(VALUE_ADAPTER, astAnnotation); + } + public TextRange getValueTextRange() { return this.valueTextRange; } - - private TextRange buildValueTextRange(Annotation astAnnotation) { - return this.getElementTextRange(VALUE_ADAPTER, astAnnotation); + + public TextRange getValueValidationTextRange() { + return this.valueValidationTextRange; } - + public boolean valueTouches(int pos) { return this.textRangeTouches(this.valueTextRange, pos); } - + // ***** fully-qualified value class name public String getFullyQualifiedValueClassName() { return this.fullyQualifiedValueClassName; } - + private void syncFullyQualifiedValueClassName(String name) { String old = this.fullyQualifiedValueClassName; this.fullyQualifiedValueClassName = name; this.firePropertyChanged(FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY, old, name); } - + private String buildFullyQualifiedValueClassName(Annotation astAnnotation) { return (this.value == null) ? null : ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(astAnnotation)); } - - + + //*********** static methods **************** - + private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { return buildAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ENUM__VALUE, SimpleTypeStringExpressionConverter.instance()); } - + static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) { return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter); } 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 000573b3f2..313c521e01 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 @@ -27,16 +27,18 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; * javax.xml.bind.annotation.XmlEnumValue */ public final class SourceXmlEnumValueAnnotation - extends SourceAnnotation - implements XmlEnumValueAnnotation -{ + extends SourceAnnotation + implements XmlEnumValueAnnotation { + public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_ENUM_VALUE); private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); private final AnnotationElementAdapter<String> valueAdapter; private String value; private TextRange valueTextRange; - + private TextRange valueValidationTextRange; + + public SourceXmlEnumValueAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { super(parent, annotatedElement, DECLARATION_ANNOTATION_ADAPTER); this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER); @@ -53,17 +55,19 @@ public final class SourceXmlEnumValueAnnotation @Override public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); - this.value = this.buildValue(astAnnotation); - this.valueTextRange = this.buildValueTextRange(astAnnotation); + this.value = buildValue(astAnnotation); + this.valueTextRange = buildValueTextRange(astAnnotation); + this.valueValidationTextRange = buildValueValidationTextRange(astAnnotation); } - + @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); - this.syncValue(this.buildValue(astAnnotation)); - this.valueTextRange = this.buildValueTextRange(astAnnotation); + syncValue(buildValue(astAnnotation)); + this.valueTextRange = buildValueTextRange(astAnnotation); + this.valueValidationTextRange = buildValueValidationTextRange(astAnnotation); } - + @Override public void toString(StringBuilder sb) { sb.append(this.value); @@ -92,13 +96,21 @@ public final class SourceXmlEnumValueAnnotation private String buildValue(Annotation astAnnotation) { return this.valueAdapter.getValue(astAnnotation); } - + + private TextRange buildValueTextRange(Annotation astAnnotation) { + return getAnnotationElementTextRange(VALUE_ADAPTER, astAnnotation); + } + + private TextRange buildValueValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(VALUE_ADAPTER, astAnnotation); + } + public TextRange getValueTextRange() { return this.valueTextRange; } - - private TextRange buildValueTextRange(Annotation astAnnotation) { - return this.getElementTextRange(VALUE_ADAPTER, astAnnotation); + + public TextRange getValueValidationTextRange() { + return this.valueValidationTextRange; } public boolean valueTouches(int pos) { @@ -107,9 +119,8 @@ public final class SourceXmlEnumValueAnnotation //*********** static methods **************** - + private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ENUM_VALUE__VALUE); } - } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRootElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRootElementAnnotation.java index 9e8e069674..0f0a05a15a 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRootElementAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRootElementAnnotation.java @@ -27,27 +27,31 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; * javax.xml.bind.annotation.XmlRootElement */ public final class SourceXmlRootElementAnnotation - extends SourceAnnotation - implements XmlRootElementAnnotation -{ + extends SourceAnnotation + implements XmlRootElementAnnotation { + public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_ROOT_ELEMENT); private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter(); private final AnnotationElementAdapter<String> nameAdapter; private String name; private TextRange nameTextRange; - + private TextRange nameValidationTextRange; + private static final DeclarationAnnotationElementAdapter<String> NAMESPACE_ADAPTER = buildNamespaceAdapter(); private final AnnotationElementAdapter<String> namespaceAdapter; private String namespace; private TextRange namespaceTextRange; - + private TextRange namespaceValidationTextRange; + + public SourceXmlRootElementAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { super(parent, annotatedElement, DECLARATION_ANNOTATION_ADAPTER); this.nameAdapter = this.buildAnnotationElementAdapter(NAME_ADAPTER); this.namespaceAdapter = this.buildAnnotationElementAdapter(NAMESPACE_ADAPTER); } - + + protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); } @@ -59,21 +63,25 @@ public final class SourceXmlRootElementAnnotation @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.name = buildName(astAnnotation); + this.nameTextRange = buildNameTextRange(astAnnotation); + this.nameValidationTextRange = buildNameValidationTextRange(astAnnotation); + this.namespace = buildNamespace(astAnnotation); + this.namespaceTextRange = buildNamespaceTextRange(astAnnotation); + this.namespaceValidationTextRange = buildNamespaceValidationTextRange(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.syncName(buildName(astAnnotation)); + this.nameTextRange = buildNameTextRange(astAnnotation); + this.nameValidationTextRange = buildNameValidationTextRange(astAnnotation); + this.syncNamespace(buildNamespace(astAnnotation)); + this.namespaceTextRange = buildNamespaceTextRange(astAnnotation); + this.namespaceValidationTextRange = buildNamespaceValidationTextRange(astAnnotation); } - + @Override public void toString(StringBuilder sb) { sb.append(this.name); @@ -103,15 +111,23 @@ public final class SourceXmlRootElementAnnotation private String buildName(Annotation astAnnotation) { return this.nameAdapter.getValue(astAnnotation); } - + private TextRange buildNameTextRange(Annotation astAnnotation) { - return this.getElementTextRange(NAME_ADAPTER, astAnnotation); + return getAnnotationElementTextRange(NAME_ADAPTER, astAnnotation); } - + + private TextRange buildNameValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(NAME_ADAPTER, astAnnotation); + } + public TextRange getNameTextRange() { return this.nameTextRange; } + public TextRange getNameValidationTextRange() { + return this.nameValidationTextRange; + } + public boolean nameTouches(int pos) { return this.textRangeTouches(this.nameTextRange, pos); } @@ -138,15 +154,23 @@ public final class SourceXmlRootElementAnnotation private String buildNamespace(Annotation astAnnotation) { return this.namespaceAdapter.getValue(astAnnotation); } - + private TextRange buildNamespaceTextRange(Annotation astAnnotation) { - return this.getElementTextRange(NAMESPACE_ADAPTER, astAnnotation); + return getAnnotationElementTextRange(NAMESPACE_ADAPTER, astAnnotation); } - + + private TextRange buildNamespaceValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(NAMESPACE_ADAPTER, astAnnotation); + } + public TextRange getNamespaceTextRange() { return this.namespaceTextRange; } + public TextRange getNamespaceValidationTextRange() { + return this.namespaceValidationTextRange; + } + public boolean namespaceTouches(int pos) { return this.textRangeTouches(this.namespaceTextRange, pos); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaTypeAnnotation.java index 558115a6cc..cd2b802357 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaTypeAnnotation.java @@ -44,11 +44,13 @@ public class SourceXmlSchemaTypeAnnotation 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<String> typeDeclarationAdapter; private final AnnotationElementAdapter<String> typeAdapter; @@ -124,21 +126,25 @@ public class SourceXmlSchemaTypeAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.name = buildName(astAnnotation); - this.nameTextRange = this.buildNameTextRange(astAnnotation); + this.nameTextRange = buildNameTextRange(astAnnotation); + this.nameValidationTextRange = buildNameValidationTextRange(astAnnotation); this.namespace = buildNamespace(astAnnotation); - this.namespaceTextRange = this.buildNamespaceTextRange(astAnnotation); + this.namespaceTextRange = buildNamespaceTextRange(astAnnotation); + this.namespaceValidationTextRange = buildNamespaceValidationTextRange(astAnnotation); this.type = buildType(astAnnotation); this.fullyQualifiedType = buildFullyQualifiedType(astAnnotation); - this.typeTextRange = this.buildTypeTextRange(astAnnotation); + this.typeTextRange = buildTypeTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); syncName(buildName(astAnnotation)); - this.nameTextRange = this.buildNameTextRange(astAnnotation); + this.nameTextRange = buildNameTextRange(astAnnotation); + this.nameValidationTextRange = buildNameValidationTextRange(astAnnotation); syncNamespace(buildNamespace(astAnnotation)); - this.namespaceTextRange = this.buildNamespaceTextRange(astAnnotation); + this.namespaceTextRange = buildNamespaceTextRange(astAnnotation); + this.namespaceValidationTextRange = buildNamespaceValidationTextRange(astAnnotation); syncType(buildType(astAnnotation)); syncFullyQualifiedType(buildFullyQualifiedType(astAnnotation)); this.typeTextRange = this.buildTypeTextRange(astAnnotation); @@ -175,15 +181,23 @@ public class SourceXmlSchemaTypeAnnotation } 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); + return textRangeTouches(this.nameTextRange, pos); } // ***** namespace @@ -207,15 +221,23 @@ public class SourceXmlSchemaTypeAnnotation 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); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTypeAnnotation.java index c0de98cf7b..2eaea7c832 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTypeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTypeAnnotation.java @@ -39,9 +39,9 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; * javax.xml.bind.annotation.XmlType */ public final class SourceXmlTypeAnnotation - extends SourceAnnotation - implements XmlTypeAnnotation -{ + extends SourceAnnotation + implements XmlTypeAnnotation { + public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_TYPE); private static final DeclarationAnnotationElementAdapter<String> FACTORY_CLASS_ADAPTER = buildFactoryClassAdapter(); @@ -50,28 +50,30 @@ public final class SourceXmlTypeAnnotation private TextRange factoryClassTextRange; private String fullyQualifiedFactoryClassName; - + private static final DeclarationAnnotationElementAdapter<String> FACTORY_METHOD_ADAPTER = buildFactoryMethodAdapter(); private final AnnotationElementAdapter<String> factoryMethodAdapter; private String factoryMethod; private TextRange factoryMethodTextRange; - + private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter(); private final AnnotationElementAdapter<String> nameAdapter; private String name; private TextRange nameTextRange; - + private TextRange nameValidationTextRange; + private static final DeclarationAnnotationElementAdapter<String> NAMESPACE_ADAPTER = buildNamespaceAdapter(); private final AnnotationElementAdapter<String> namespaceAdapter; private String namespace; private TextRange namespaceTextRange; - + private TextRange namespaceValidationTextRange; + private final IndexedDeclarationAnnotationElementAdapter<String> propOrderDeclarationAdapter; private final AnnotationElementAdapter<String[]> propOrderAdapter; private final Vector<String> propOrder = new Vector<String>(); private TextRange propOrderTextRange; private final Vector<TextRange> propTextRanges = new Vector<TextRange>(); - + public SourceXmlTypeAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { super(parent, annotatedElement, DECLARATION_ANNOTATION_ADAPTER); this.factoryClassAdapter = this.buildAnnotationElementAdapter(FACTORY_CLASS_ADAPTER); @@ -101,41 +103,43 @@ public final class SourceXmlTypeAnnotation public String getAnnotationName() { return JAXB.XML_TYPE; } - + @Override public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); - this.factoryClass = this.buildFactoryClass(astAnnotation); - this.factoryClassTextRange = this.buildFactoryClassTextRange(astAnnotation); - this.fullyQualifiedFactoryClassName = this.buildFullyQualifiedFactoryClassName(astAnnotation); - this.factoryMethod = this.buildFactoryMethod(astAnnotation); - this.factoryMethodTextRange = this.buildFactoryMethodTextRange(astAnnotation); - this.name = this.buildName(astAnnotation); - this.nameTextRange = this.buildNameTextRange(astAnnotation); - this.namespace = this.buildNamespace(astAnnotation); - this.namespaceTextRange = this.buildNamespaceTextRange(astAnnotation); - this.initializePropOrder(astAnnotation); - this.propOrderTextRange = this.buildPropOrderTextRange(astAnnotation); - this.syncPropTextRanges(astAnnotation); + this.factoryClass = buildFactoryClass(astAnnotation); + this.factoryClassTextRange = buildFactoryClassTextRange(astAnnotation); + this.fullyQualifiedFactoryClassName = buildFullyQualifiedFactoryClassName(astAnnotation); + this.factoryMethod = buildFactoryMethod(astAnnotation); + this.factoryMethodTextRange = buildFactoryMethodTextRange(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); + initializePropOrder(astAnnotation); + this.propOrderTextRange = buildPropOrderTextRange(astAnnotation); + syncPropTextRanges(astAnnotation); } - + @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); - this.syncFactoryClass(this.buildFactoryClass(astAnnotation)); - this.factoryClassTextRange = this.buildFactoryClassTextRange(astAnnotation); - this.syncFullyQualifiedFactoryClassName(this.buildFullyQualifiedFactoryClassName(astAnnotation)); - this.syncFactoryMethod(this.buildFactoryMethod(astAnnotation)); - this.factoryMethodTextRange = this.buildFactoryMethodTextRange(astAnnotation); - this.syncName(this.buildName(astAnnotation)); - this.nameTextRange = this.buildNameTextRange(astAnnotation); - this.syncNamespace(this.buildNamespace(astAnnotation)); - this.namespaceTextRange = this.buildNamespaceTextRange(astAnnotation); - this.syncPropOrder(astAnnotation); - this.propOrderTextRange = this.buildPropOrderTextRange(astAnnotation); - this.syncPropTextRanges(astAnnotation); + syncFactoryClass(buildFactoryClass(astAnnotation)); + this.factoryClassTextRange = buildFactoryClassTextRange(astAnnotation); + syncFullyQualifiedFactoryClassName(buildFullyQualifiedFactoryClassName(astAnnotation)); + syncFactoryMethod(buildFactoryMethod(astAnnotation)); + this.factoryMethodTextRange = buildFactoryMethodTextRange(astAnnotation); + syncName(buildName(astAnnotation)); + this.nameTextRange = buildNameTextRange(astAnnotation); + this.syncNamespace(buildNamespace(astAnnotation)); + this.namespaceTextRange = buildNamespaceTextRange(astAnnotation); + syncPropOrder(astAnnotation); + this.propOrderTextRange = buildPropOrderTextRange(astAnnotation); + syncPropTextRanges(astAnnotation); } - + @Override public void toString(StringBuilder sb) { sb.append(this.name); @@ -241,15 +245,23 @@ public final class SourceXmlTypeAnnotation private String buildName(Annotation astAnnotation) { return this.nameAdapter.getValue(astAnnotation); } - + private TextRange buildNameTextRange(Annotation astAnnotation) { - return this.getElementTextRange(NAME_ADAPTER, astAnnotation); + return getAnnotationElementTextRange(NAME_ADAPTER, astAnnotation); } - + + private TextRange buildNameValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(NAME_ADAPTER, astAnnotation); + } + public TextRange getNameTextRange() { return this.nameTextRange; } + public TextRange getNameValidationTextRange() { + return this.nameValidationTextRange; + } + public boolean nameTouches(int pos) { return this.textRangeTouches(this.nameTextRange, pos); } @@ -276,15 +288,23 @@ public final class SourceXmlTypeAnnotation private String buildNamespace(Annotation astAnnotation) { return this.namespaceAdapter.getValue(astAnnotation); } - + private TextRange buildNamespaceTextRange(Annotation astAnnotation) { - return this.getElementTextRange(NAMESPACE_ADAPTER, astAnnotation); + return getAnnotationElementTextRange(NAMESPACE_ADAPTER, astAnnotation); } - + + private TextRange buildNamespaceValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(NAMESPACE_ADAPTER, astAnnotation); + } + public TextRange getNamespaceTextRange() { return this.namespaceTextRange; } + public TextRange getNamespaceValidationTextRange() { + return this.namespaceValidationTextRange; + } + public boolean namespaceTouches(int pos) { return this.textRangeTouches(this.namespaceTextRange, pos); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/QNameAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/QNameAnnotation.java index 09ad8efb0a..31bf57e28c 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/QNameAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/QNameAnnotation.java @@ -45,12 +45,18 @@ public interface QNameAnnotation void setNamespace(String namespace); /** - * Return the {@link TextRange} for the 'namespace' element. If the element - * does not exist return the {@link TextRange} for the annotation itself. + * Return the {@link TextRange} for the 'name' element. If the element + * does not exist return null. */ TextRange getNamespaceTextRange(); /** + * Return the {@link TextRange} for the 'name' element. If the element + * does not exist return the {@link TextRange} for the annotation itself. + */ + TextRange getNamespaceValidationTextRange(); + + /** * Return whether the specified position touches the 'namespace' element. * Return false if the element does not exist. */ @@ -75,11 +81,18 @@ public interface QNameAnnotation /** * Return the {@link TextRange} for the 'name' element. If the element - * does not exist return the {@link TextRange} for the annotation itself. + * does not exist return null. */ TextRange getNameTextRange(); /** + * Return the {@link TextRange} for the 'name' element. If the element + * does not exist return the {@link TextRange} for the annotation itself. + */ + TextRange getNameValidationTextRange(); + + + /** * Return whether the specified position touches the 'name' element. * Return false if the element does not exist. */ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementDeclAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementDeclAnnotation.java index 2277ca8297..d9e5b21059 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementDeclAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementDeclAnnotation.java @@ -92,12 +92,18 @@ public interface XmlElementDeclAnnotation void setSubstitutionHeadNamespace(String substitutionHeadNamespace); /** - * Return the {@link TextRange} for the 'substitutionHeadNamespace' element. If the element - * does not exist return the {@link TextRange} for the XmlElementDecl annotation. + * Return the text range associated with the 'subtitutionHeadNamespace' element. + * Return null if the element is absent. */ TextRange getSubstitutionHeadNamespaceTextRange(); /** + * Return the validation text range associated with the 'subtitutionHeadNamespace' element. + * Return the text range of this annotation if the element is absent. + */ + TextRange getSubstitutionHeadNamespaceValidationTextRange(); + + /** * Return whether the specified position touches the 'substitutionHeadNamespace' element. * Return false if the element does not exist. */ @@ -124,12 +130,18 @@ public interface XmlElementDeclAnnotation void setSubstitutionHeadName(String substitutionHeadName); /** - * Return the {@link TextRange} for the 'substitutionHeadName' element. If the element - * does not exist return the {@link TextRange} for the XmlElementDecl annotation. + * Return the text range associated with the 'subtitutionHeadName' element. + * Return null if the element is absent. */ TextRange getSubstitutionHeadNameTextRange(); /** + * Return the validation text range associated with the 'subtitutionHeadName' element. + * Return the text range of this annotation if the element is absent. + */ + TextRange getSubstitutionHeadNameValidationTextRange(); + + /** * Return whether the specified position touches the 'substitutionHeadName' element. * Return false if the element does not exist. */ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumAnnotation.java index e7e83b4bc2..4615d02760 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumAnnotation.java @@ -45,12 +45,19 @@ public interface XmlEnumAnnotation * Set to null to remove the element. */ void setValue(String value); + /** * Return the {@link TextRange} for the 'value' element. If the element - * does not exist return the {@link TextRange} for the XmlEnum annotation. + * does not exist return null. */ TextRange getValueTextRange(); - + + /** + * Return the {@link TextRange} for the 'value' element. If the element + * does not exist return the {@link TextRange} for the XmlEnum annotation. + */ + TextRange getValueValidationTextRange(); + /** * Return the fully-qualified value class name as resolved by the AST's bindings. * <pre> @@ -61,5 +68,4 @@ public interface XmlEnumAnnotation */ String getFullyQualifiedValueClassName(); String FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY = "fullyQualifiedValueClassName"; //$NON-NLS-1$ - } 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 d86bc06c33..5311841936 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 @@ -44,11 +44,17 @@ 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. + * does not exist return null. */ TextRange getValueTextRange(); /** + * Return the {@link TextRange} for the 'value' element. If the element + * does not exist return the {@link TextRange} for the XmlEnumValue annotation. + */ + TextRange getValueValidationTextRange(); + + /** * Return whether the given position touches the 'value' element value. */ boolean valueTouches(int pos); diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/model/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/oxm/EXmlRootElement.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/model/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/oxm/EXmlRootElement.java index e33ba90093..bd86e7fae9 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/model/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/oxm/EXmlRootElement.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/model/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/oxm/EXmlRootElement.java @@ -257,7 +257,7 @@ public class EXmlRootElement extends EBaseObjectImpl implements EBaseObject // ***** validation *****
- public TextRange getNamespaceTextRange() {
+ public TextRange getNamespaceValidationTextRange() {
return getAttributeTextRange(Oxm.NAMESPACE);
}
@@ -266,7 +266,7 @@ public class EXmlRootElement extends EBaseObjectImpl implements EBaseObject return (textRange != null) && (textRange.touches(pos));
}
- public TextRange getNameTextRange() {
+ public TextRange getNameValidationTextRange() {
return getAttributeTextRange(Oxm.NAME);
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/model/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/oxm/EXmlType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/model/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/oxm/EXmlType.java index 199c29233b..be087f7f11 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/model/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/oxm/EXmlType.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/model/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/oxm/EXmlType.java @@ -466,7 +466,7 @@ public class EXmlType extends EBaseObjectImpl implements EBaseObject // ***** validation *****
- public TextRange getNamespaceTextRange() {
+ public TextRange getNamespaceValidationTextRange() {
return getAttributeTextRange(Oxm.NAMESPACE);
}
@@ -475,7 +475,7 @@ public class EXmlType extends EBaseObjectImpl implements EBaseObject return (textRange != null) && (textRange.touches(pos));
}
- public TextRange getNameTextRange() {
+ public TextRange getNameValidationTextRange() {
return getAttributeTextRange(Oxm.NAME);
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaClassMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaClassMapping.java index b2d32ca966..65e14dd3bd 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaClassMapping.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaClassMapping.java @@ -12,8 +12,6 @@ package org.eclipse.jpt.jaxb.eclipselink.core.internal.context.java; import java.util.List; import org.eclipse.jpt.common.utility.internal.iterable.EmptyIterable; import org.eclipse.jpt.common.utility.internal.iterable.IterableTools; -import org.eclipse.jpt.common.utility.internal.predicate.PredicateAdapter; -import org.eclipse.jpt.common.utility.predicate.Predicate; import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; import org.eclipse.jpt.jaxb.core.context.XmlNamedNodeMapping; 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 ff84f9401a..f9adbb0f40 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 @@ -166,7 +166,7 @@ public class ELJavaXmlInverseReferenceMapping if (StringTools.isBlank(mappedBy)) { messages.add( this.buildValidationMessage( - getMappedByTextRange(), + getMappedByValidationTextRange(), JptJaxbEclipseLinkCoreValidationMessages.XML_INVERSE_REFERENCE__MAPPED_BY_NOT_SPECIFIED )); return; @@ -182,7 +182,7 @@ public class ELJavaXmlInverseReferenceMapping if (referencedAttribute == null) { messages.add( this.buildValidationMessage( - getMappedByTextRange(), + getMappedByValidationTextRange(), JptJaxbEclipseLinkCoreValidationMessages.XML_INVERSE_REFERENCE__MAPPED_BY_NOT_RESOLVED, mappedBy, referencedClassMapping.getTypeName().getFullyQualifiedName())); @@ -193,7 +193,7 @@ public class ELJavaXmlInverseReferenceMapping referencedAttribute.getMappingKey())) { messages.add( this.buildValidationMessage( - getMappedByTextRange(), + getMappedByValidationTextRange(), JptJaxbEclipseLinkCoreValidationMessages.XML_INVERSE_REFERENCE__MAPPED_BY_ILLEGAL_MAPPING_TYPE, mappedBy, referencedClassMapping.getTypeName().getFullyQualifiedName())); @@ -213,8 +213,7 @@ public class ELJavaXmlInverseReferenceMapping MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY }; - protected TextRange getMappedByTextRange() { - TextRange textRange = getXmlInverseReferenceAnnotation().getMappedByTextRange(); - return (textRange != null) ? textRange : getValidationTextRange(); + protected TextRange getMappedByValidationTextRange() { + return getXmlInverseReferenceAnnotation().getMappedByValidationTextRange(); } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlPath.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlPath.java index 5a5106e765..715c141824 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlPath.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlPath.java @@ -137,7 +137,7 @@ public class ELJavaXmlPath messages.add( this.buildValidationMessage( ELJavaXmlPath.this, - getValueTextRange(), + getValueValidationTextRange(), JptJaxbEclipseLinkCoreValidationMessages.XPATH__ROOT_NOT_SUPPORTED )); return; @@ -149,10 +149,14 @@ public class ELJavaXmlPath } protected TextRange getValueTextRange() { - // should never be null + // could be null if there is no value (or no "") return getAnnotation().getValueTextRange(); } + protected TextRange getValueValidationTextRange() { + return getAnnotation().getValueValidationTextRange(); + } + public interface Context { @@ -178,6 +182,7 @@ public class ELJavaXmlPath } public TextRange getTextRange() { + // should never be null when there is an xpath return ELJavaXmlPath.this.getValueTextRange(); } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/oxm/AbstractOxmTypeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/oxm/AbstractOxmTypeMapping.java index ca20e4ef9f..5c08905465 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/oxm/AbstractOxmTypeMapping.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/oxm/AbstractOxmTypeMapping.java @@ -605,7 +605,7 @@ public abstract class AbstractOxmTypeMapping this.buildDefaultNamespace())) {
messages.add(
this.buildValidationMessage(
- this.proxy.getNamespaceTextRange(),
+ this.proxy.getNamespaceValidationTextRange(),
JptJaxbCoreValidationMessages.XML_TYPE__UNMATCHING_NAMESPACE_FOR_ANONYMOUS_TYPE
));
}
@@ -656,9 +656,9 @@ public abstract class AbstractOxmTypeMapping return (eXmlType == null) ? false : eXmlType.namespaceTouches(pos);
}
- public TextRange getNamespaceTextRange() {
+ public TextRange getNamespaceValidationTextRange() {
EXmlType eXmlType = getEXmlType(false);
- return (eXmlType == null) ? null : eXmlType.getNamespaceTextRange();
+ return (eXmlType == null) ? null : eXmlType.getNamespaceValidationTextRange();
}
public String getName() {
@@ -675,9 +675,9 @@ public abstract class AbstractOxmTypeMapping return (eXmlType == null) ? false : eXmlType.nameTouches(pos);
}
- public TextRange getNameTextRange() {
+ public TextRange getNameValidationTextRange() {
EXmlType eXmlType = getEXmlType(false);
- return (eXmlType == null) ? null : eXmlType.getNameTextRange();
+ return (eXmlType == null) ? null : eXmlType.getNameValidationTextRange();
}
} } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/oxm/OxmXmlRootElementImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/oxm/OxmXmlRootElementImpl.java index 0c6f7f4139..03ee41a0ff 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/oxm/OxmXmlRootElementImpl.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/oxm/OxmXmlRootElementImpl.java @@ -192,8 +192,8 @@ public class OxmXmlRootElementImpl return getEXmlRootElement().namespaceTouches(pos);
}
- public TextRange getNamespaceTextRange() {
- return getEXmlRootElement().getNamespaceTextRange();
+ public TextRange getNamespaceValidationTextRange() {
+ return getEXmlRootElement().getNamespaceValidationTextRange();
}
public String getName() {
@@ -208,8 +208,8 @@ public class OxmXmlRootElementImpl return getEXmlRootElement().nameTouches(pos);
}
- public TextRange getNameTextRange() {
- return getEXmlRootElement().getNameTextRange();
+ public TextRange getNameValidationTextRange() {
+ return getEXmlRootElement().getNameValidationTextRange();
}
}
} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlDiscriminatorNodeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlDiscriminatorNodeAnnotation.java index d2ed31b41a..8cd8e8ed6d 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlDiscriminatorNodeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlDiscriminatorNodeAnnotation.java @@ -70,6 +70,10 @@ public class BinaryXmlDiscriminatorNodeAnnotation throw new UnsupportedOperationException(); } + public TextRange getValueValidationTextRange() { + throw new UnsupportedOperationException(); + } + public boolean valueTouches(int pos) { 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/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 c728adfeb3..87f306e7aa 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 @@ -70,6 +70,10 @@ public class BinaryXmlDiscriminatorValueAnnotation throw new UnsupportedOperationException(); } + public TextRange getValueValidationTextRange() { + throw new UnsupportedOperationException(); + } + public boolean valueTouches(int pos) { 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 dd8f19f4ee..db8995e2c1 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 @@ -70,6 +70,10 @@ public class BinaryXmlInverseReferenceAnnotation throw new UnsupportedOperationException(); } + public TextRange getMappedByValidationTextRange() { + throw new UnsupportedOperationException(); + } + public boolean mappedByTouches(int pos) { 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/BinaryXmlJoinNodeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlJoinNodeAnnotation.java index b67a3c7a7c..a942f73de0 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlJoinNodeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlJoinNodeAnnotation.java @@ -74,6 +74,10 @@ public class BinaryXmlJoinNodeAnnotation throw new UnsupportedOperationException(); } + public TextRange getXmlPathValidationTextRange() { + throw new UnsupportedOperationException(); + } + public boolean xmlPathTouches(int pos) { throw new UnsupportedOperationException(); } @@ -103,6 +107,10 @@ public class BinaryXmlJoinNodeAnnotation throw new UnsupportedOperationException(); } + public TextRange getReferencedXmlPathValidationTextRange() { + throw new UnsupportedOperationException(); + } + public boolean referencedXmlPathTouches(int pos) { 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/BinaryXmlPathAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlPathAnnotation.java index 96e923e73b..15f871e300 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlPathAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlPathAnnotation.java @@ -70,6 +70,10 @@ public class BinaryXmlPathAnnotation throw new UnsupportedOperationException(); } + public TextRange getValueValidationTextRange() { + throw new UnsupportedOperationException(); + } + public boolean valueTouches(int pos) { 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/SourceXmlDiscriminatorNodeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlDiscriminatorNodeAnnotation.java index 6ceb40daab..a068afe237 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlDiscriminatorNodeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlDiscriminatorNodeAnnotation.java @@ -39,6 +39,7 @@ public class SourceXmlDiscriminatorNodeAnnotation private final AnnotationElementAdapter<String> valueAdapter; private String value; private TextRange valueTextRange; + private TextRange valueValidationTextRange; public SourceXmlDiscriminatorNodeAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { @@ -76,14 +77,16 @@ public class SourceXmlDiscriminatorNodeAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.value = buildValue(astAnnotation); - this.valueTextRange = this.buildValueTextRange(astAnnotation); + this.valueTextRange = buildValueTextRange(astAnnotation); + this.valueValidationTextRange = buildValueValidationTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); syncValue(buildValue(astAnnotation)); - this.valueTextRange = this.buildValueTextRange(astAnnotation); + this.valueTextRange = buildValueTextRange(astAnnotation); + this.valueValidationTextRange = buildValueValidationTextRange(astAnnotation); } @Override @@ -114,13 +117,21 @@ public class SourceXmlDiscriminatorNodeAnnotation private String buildValue(Annotation astAnnotation) { return this.valueAdapter.getValue(astAnnotation); } + + private TextRange buildValueTextRange(Annotation astAnnotation) { + return getAnnotationElementTextRange(this.valueDeclarationAdapter, astAnnotation); + } + private TextRange buildValueValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(this.valueDeclarationAdapter, astAnnotation); + } + public TextRange getValueTextRange() { return this.valueTextRange; } - - private TextRange buildValueTextRange(Annotation astAnnotation) { - return this.getElementTextRange(this.valueDeclarationAdapter, astAnnotation); + + public TextRange getValueValidationTextRange() { + return this.valueValidationTextRange; } public boolean valueTouches(int pos) { 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 58d3916dec..36893f582d 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 AnnotationElementAdapter<String> valueAdapter; private String value; private TextRange valueTextRange; + private TextRange valueValidationTextRange; public SourceXmlDiscriminatorValueAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { @@ -76,14 +77,16 @@ public class SourceXmlDiscriminatorValueAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.value = buildValue(astAnnotation); - this.valueTextRange = this.buildValueTextRange(astAnnotation); + this.valueTextRange = buildValueTextRange(astAnnotation); + this.valueValidationTextRange = buildValueValidationTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); syncValue(buildValue(astAnnotation)); - this.valueTextRange = this.buildValueTextRange(astAnnotation); + this.valueTextRange = buildValueTextRange(astAnnotation); + this.valueValidationTextRange = buildValueValidationTextRange(astAnnotation); } @Override @@ -114,13 +117,21 @@ public class SourceXmlDiscriminatorValueAnnotation private String buildValue(Annotation astAnnotation) { return this.valueAdapter.getValue(astAnnotation); } - + + private TextRange buildValueTextRange(Annotation astAnnotation) { + return getAnnotationElementTextRange(this.valueDeclarationAdapter, astAnnotation); + } + + private TextRange buildValueValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(this.valueDeclarationAdapter, astAnnotation); + } + public TextRange getValueTextRange() { return this.valueTextRange; } - - private TextRange buildValueTextRange(Annotation astAnnotation) { - return this.getElementTextRange(this.valueDeclarationAdapter, astAnnotation); + + public TextRange getValueValidationTextRange() { + return this.valueValidationTextRange; } public boolean valueTouches(int pos) { 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 355660b56f..fc66d6ced9 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 AnnotationElementAdapter<String> mappedByAdapter; private String mappedBy; private TextRange mappedByTextRange; + private TextRange mappedByValidationTextRange; public SourceXmlInverseReferenceAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { @@ -66,14 +67,16 @@ public class SourceXmlInverseReferenceAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.mappedBy = buildMappedBy(astAnnotation); - this.mappedByTextRange = this.buildMappedByTextRange(astAnnotation); + this.mappedByTextRange = buildMappedByTextRange(astAnnotation); + this.mappedByValidationTextRange = buildMappedByValidationTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); this.syncMappedBy(buildMappedBy(astAnnotation)); - this.mappedByTextRange = this.buildMappedByTextRange(astAnnotation); + this.mappedByTextRange = buildMappedByTextRange(astAnnotation); + this.mappedByValidationTextRange = buildMappedByValidationTextRange(astAnnotation); } @Override @@ -108,9 +111,17 @@ public class SourceXmlInverseReferenceAnnotation public TextRange getMappedByTextRange() { return this.mappedByTextRange; } - + + public TextRange getMappedByValidationTextRange() { + return this.mappedByValidationTextRange; + } + private TextRange buildMappedByTextRange(Annotation astAnnotation) { - return this.getElementTextRange(this.mappedByDeclarationAdapter, astAnnotation); + return getAnnotationElementTextRange(this.mappedByDeclarationAdapter, astAnnotation); + } + + private TextRange buildMappedByValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(this.mappedByDeclarationAdapter, astAnnotation); } public boolean mappedByTouches(int pos) { diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlJoinNodeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlJoinNodeAnnotation.java index 2432cc57ec..3d2952e982 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlJoinNodeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlJoinNodeAnnotation.java @@ -43,11 +43,13 @@ public class SourceXmlJoinNodeAnnotation private final AnnotationElementAdapter<String> xmlPathAdapter; private String xmlPath; private TextRange xmlPathTextRange; + private TextRange xmlPathValidationTextRange; private final DeclarationAnnotationElementAdapter<String> referencedXmlPathDeclarationAdapter; private final AnnotationElementAdapter<String> referencedXmlPathAdapter; private String referencedXmlPath; private TextRange referencedXmlPathTextRange; + private TextRange referencedXmlPathValidationTextRange; public static SourceXmlJoinNodeAnnotation buildSourceXmlJoinNodeAnnotation( @@ -101,18 +103,22 @@ public class SourceXmlJoinNodeAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.xmlPath = buildXmlPath(astAnnotation); - this.xmlPathTextRange = this.buildXmlPathTextRange(astAnnotation); + this.xmlPathTextRange = buildXmlPathTextRange(astAnnotation); + this.xmlPathValidationTextRange = buildXmlPathValidationTextRange(astAnnotation); this.referencedXmlPath = buildReferencedXmlPath(astAnnotation); - this.referencedXmlPathTextRange = this.buildReferencedXmlPathTextRange(astAnnotation); + this.referencedXmlPathTextRange = buildReferencedXmlPathTextRange(astAnnotation); + this.referencedXmlPathValidationTextRange = buildReferencedXmlPathValidationTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); syncXmlPath(buildXmlPath(astAnnotation)); - this.xmlPathTextRange = this.buildXmlPathTextRange(astAnnotation); + this.xmlPathTextRange = buildXmlPathTextRange(astAnnotation); + this.xmlPathValidationTextRange = buildXmlPathValidationTextRange(astAnnotation); syncReferencedXmlPath(buildReferencedXmlPath(astAnnotation)); - this.referencedXmlPathTextRange = this.buildReferencedXmlPathTextRange(astAnnotation); + this.referencedXmlPathTextRange = buildReferencedXmlPathTextRange(astAnnotation); + this.referencedXmlPathValidationTextRange = buildReferencedXmlPathValidationTextRange(astAnnotation); } @Override @@ -143,17 +149,25 @@ public class SourceXmlJoinNodeAnnotation private String buildXmlPath(Annotation astAnnotation) { return this.xmlPathAdapter.getValue(astAnnotation); } - + private TextRange buildXmlPathTextRange(Annotation astAnnotation) { - return this.getElementTextRange(this.xmlPathDeclarationAdapter, astAnnotation); + return getAnnotationElementTextRange(this.xmlPathDeclarationAdapter, astAnnotation); } - + + private TextRange buildXmlPathValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(this.xmlPathDeclarationAdapter, astAnnotation); + } + public TextRange getXmlPathTextRange() { return this.xmlPathTextRange; } + public TextRange getXmlPathValidationTextRange() { + return this.xmlPathValidationTextRange; + } + public boolean xmlPathTouches(int pos) { - return this.textRangeTouches(this.xmlPathTextRange, pos); + return textRangeTouches(this.xmlPathTextRange, pos); } @@ -179,17 +193,25 @@ public class SourceXmlJoinNodeAnnotation private String buildReferencedXmlPath(Annotation astAnnotation) { return this.referencedXmlPathAdapter.getValue(astAnnotation); } - + private TextRange buildReferencedXmlPathTextRange(Annotation astAnnotation) { - return this.getElementTextRange(this.referencedXmlPathDeclarationAdapter, astAnnotation); + return getAnnotationElementTextRange(this.referencedXmlPathDeclarationAdapter, astAnnotation); } - + + private TextRange buildReferencedXmlPathValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(this.referencedXmlPathDeclarationAdapter, astAnnotation); + } + public TextRange getReferencedXmlPathTextRange() { return this.referencedXmlPathTextRange; } + public TextRange getReferencedXmlPathValidationTextRange() { + return this.referencedXmlPathValidationTextRange; + } + public boolean referencedXmlPathTouches(int pos) { - return this.textRangeTouches(this.referencedXmlPathTextRange, pos); + return textRangeTouches(this.referencedXmlPathTextRange, pos); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlPathAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlPathAnnotation.java index 173473e6b5..e2dd62d3f0 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlPathAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlPathAnnotation.java @@ -43,6 +43,7 @@ public class SourceXmlPathAnnotation private final AnnotationElementAdapter<String> valueAdapter; private String value; private TextRange valueTextRange; + private TextRange valueValidationTextRange; public static SourceXmlPathAnnotation buildSourceXmlPathAnnotation( @@ -90,14 +91,16 @@ public class SourceXmlPathAnnotation public void initialize(Annotation astAnnotation) { super.initialize(astAnnotation); this.value = buildValue(astAnnotation); - this.valueTextRange = this.buildValueTextRange(astAnnotation); + this.valueTextRange = buildValueTextRange(astAnnotation); + this.valueValidationTextRange = buildValueValidationTextRange(astAnnotation); } @Override public void synchronizeWith(Annotation astAnnotation) { super.synchronizeWith(astAnnotation); syncValue(buildValue(astAnnotation)); - this.valueTextRange = this.buildValueTextRange(astAnnotation); + this.valueTextRange = buildValueTextRange(astAnnotation); + this.valueValidationTextRange = buildValueValidationTextRange(astAnnotation); } @Override @@ -128,13 +131,21 @@ public class SourceXmlPathAnnotation private String buildValue(Annotation astAnnotation) { return this.valueAdapter.getValue(astAnnotation); } - + + private TextRange buildValueTextRange(Annotation astAnnotation) { + return getAnnotationElementTextRange(this.valueDeclarationAdapter, astAnnotation); + } + + private TextRange buildValueValidationTextRange(Annotation astAnnotation) { + return getElementTextRange(this.valueDeclarationAdapter, astAnnotation); + } + public TextRange getValueTextRange() { return this.valueTextRange; } - - private TextRange buildValueTextRange(Annotation astAnnotation) { - return this.getElementTextRange(this.valueDeclarationAdapter, astAnnotation); + + public TextRange getValueValidationTextRange() { + return this.valueValidationTextRange; } public boolean valueTouches(int pos) { diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlDiscriminatorNodeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlDiscriminatorNodeAnnotation.java index 245199d229..8ab4a64315 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlDiscriminatorNodeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlDiscriminatorNodeAnnotation.java @@ -47,11 +47,17 @@ public interface XmlDiscriminatorNodeAnnotation /** * Return the text range associated with the 'value' element. - * Return the text range of this annotation if the element is absent. + * Return null if the element is absent. */ TextRange getValueTextRange(); /** + * Return the text range associated with the 'value' element. + * Return the text range of this annotation if the element is absent. + */ + TextRange getValueValidationTextRange(); + + /** * Return whether the specified text position is within the 'value' element. */ boolean valueTouches(int pos); 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 55a1bbd155..150702362d 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 @@ -47,7 +47,13 @@ public interface XmlDiscriminatorValueAnnotation /** * Return the text range associated with the 'value' element. - * Return the text range of this annotation if the element is absent. + * Return null if the element is absent. */ TextRange getValueTextRange(); + + /** + * Return the text range associated with the 'value' element. + * Return the text range of this annotation if the element is absent. + */ + TextRange getValueValidationTextRange(); } 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 ad04e4511a..676f0e0c68 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 @@ -47,12 +47,19 @@ public interface XmlInverseReferenceAnnotation /** * Return the text range associated with the 'mappedBy' element. - * Return the text range of this annotation if the element is absent. + * Return null if the element is absent. */ TextRange getMappedByTextRange(); /** + * Return the validation text range associated with the 'mappedBy' element. + * Return the text range of this annotation if the element is absent. + */ + TextRange getMappedByValidationTextRange(); + + /** * Return whether the specified text position is within the 'mappedBy' element. + * Always return false if the element does not exist. */ boolean mappedByTouches(int pos); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlJoinNodeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlJoinNodeAnnotation.java index d462c295b0..b848a1dcc0 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlJoinNodeAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlJoinNodeAnnotation.java @@ -47,12 +47,19 @@ public interface XmlJoinNodeAnnotation /** * Return the text range associated with the 'xmlPath' element. - * Return the text range of this annotation if the element is absent. + * Return null if the element is absent. */ TextRange getXmlPathTextRange(); /** + * Return the text range associated with the 'xmlPath' element. + * Return the text range of this annotation if the element is absent. + */ + TextRange getXmlPathValidationTextRange(); + + /** * Return whether the specified text position is within the 'xmlPath' element. + * Return false if the element is absent. */ boolean xmlPathTouches(int pos); @@ -76,12 +83,19 @@ public interface XmlJoinNodeAnnotation /** * Return the text range associated with the 'referencedXmlPath' element. - * Return the text range of this annotation if the element is absent. + * Return null if the element is absent. */ TextRange getReferencedXmlPathTextRange(); /** + * Return the text range associated with the 'referencedXmlPath' element. + * Return the text range of this annotation if the element is absent. + */ + TextRange getReferencedXmlPathValidationTextRange(); + + /** * Return whether the specified text position is within the 'referencedXmlPath' element. + * Return null if the element is absent. */ boolean referencedXmlPathTouches(int pos); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlPathAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlPathAnnotation.java index 4ae0c51bd5..2f5848ac0d 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlPathAnnotation.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlPathAnnotation.java @@ -47,12 +47,19 @@ public interface XmlPathAnnotation /** * Return the text range associated with the 'value' element. - * Return the text range of this annotation if the element is absent. + * Return null if the element is absent. */ TextRange getValueTextRange(); /** + * Return the text range associated with the 'value' element. + * Return the text range of this annotation if the element is absent. + */ + TextRange getValueValidationTextRange(); + + /** * Return whether the specified text position is within the 'value' element. + * Return false if the element is absent. */ boolean valueTouches(int pos); } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java index e14b1f3b03..9881d0aecc 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java @@ -147,7 +147,7 @@ public class JaxbJavaCompletionProposalComputer for (JaxbContextNode javaNode : javaNodes) { for (String proposal : this.buildCompletionProposals(javaNode, context.getInvocationOffset(), filter)) { if (tokenKind == CompletionContext.TOKEN_KIND_STRING_LITERAL) {//already quoted - proposals.add(new CompletionProposal(proposal, tokenStart, tokenEnd - tokenStart - 1, proposal.length())); + proposals.add(new CompletionProposal(proposal, tokenStart + 1, tokenEnd - tokenStart - 1, proposal.length())); } else {//add the quotes proposals.add(new CompletionProposal("\"" + proposal + "\"", tokenStart, tokenEnd - tokenStart + 1, proposal.length() + 2)); //$NON-NLS-1$ //$NON-NLS-2$ |