Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRef.java')
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRef.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRef.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRef.java
index 31760f8c12..9141e40481 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRef.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementRef.java
@@ -195,16 +195,18 @@ public class GenericJavaXmlElementRef
public Iterable<String> getReferencedXmlTypeNames() {
// only return the specified type - the default type should already be included
- if (this.specifiedType != null) {
- String fqType = getFullyQualifiedType();
- if (! JAXB.JAXB_ELEMENT.equals(fqType)) {
- return new SingleElementIterable(fqType);
- }
+ if (this.specifiedType != null
+ && ! isTypeJAXBElement()) {
+ return new SingleElementIterable(getFullyQualifiedType());
}
return EmptyIterable.instance();
}
+ protected boolean isTypeJAXBElement() {
+ return (StringTools.stringsAreEqual(JAXB.JAXB_ELEMENT, getFullyQualifiedType()));
+ }
+
// ***** content assist *****
@@ -256,13 +258,13 @@ public class GenericJavaXmlElementRef
else if (! StringTools.stringIsEmpty(this.specifiedType)
// verify that type actually exists before validating
&& JDTTools.findType(getJaxbProject().getJavaProject(), fqType) != null) {
- String attributeBaseType = getPersistentAttribute().getJavaResourceAttributeBaseTypeName();
- if (! JDTTools.typeIsSubType(getJaxbProject().getJavaProject(), fqType, attributeBaseType)) {
+ String attributeValueType = getContext().getAttributeMapping().getValueTypeName();
+ if (! JDTTools.typeIsSubType(getJaxbProject().getJavaProject(), fqType, attributeValueType)) {
messages.add(
DefaultValidationMessages.buildMessage(
IMessage.HIGH_SEVERITY,
JaxbValidationMessages.XML_ELEMENT_REF__ILLEGAL_TYPE,
- new String[] { attributeBaseType },
+ new String[] { attributeValueType },
this,
getTypeTextRange(astRoot)));
@@ -275,7 +277,7 @@ public class GenericJavaXmlElementRef
DefaultValidationMessages.buildMessage(
IMessage.HIGH_SEVERITY,
JaxbValidationMessages.XML_ELEMENT_REF__NO_ROOT_ELEMENT,
- new String[] { attributeBaseType },
+ new String[] { attributeValueType },
this,
getTypeTextRange(astRoot)));
}
@@ -297,7 +299,7 @@ public class GenericJavaXmlElementRef
}
protected boolean isTypeJAXBElement() {
- return JAXB.JAXB_ELEMENT.equals(GenericJavaXmlElementRef.this.getFullyQualifiedType());
+ return GenericJavaXmlElementRef.this.isTypeJAXBElement();
}
protected JaxbTypeMapping getReferencedTypeMapping() {

Back to the top