diff options
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse')
20 files changed, 190 insertions, 58 deletions
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); } |