Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2012-04-03 17:23:33 -0400
committerpfullbright2012-04-03 17:23:33 -0400
commit8a8b115bfaa929aec56a79acd4ac9ed462e41d5b (patch)
tree05a17dbd9299295c35aa226cf0c23dd26f52a87d
parent9ac884fa50887c9f7364b9799bbca03a76501c91 (diff)
downloadwebtools.dali-8a8b115bfaa929aec56a79acd4ac9ed462e41d5b.tar.gz
webtools.dali-8a8b115bfaa929aec56a79acd4ac9ed462e41d5b.tar.xz
webtools.dali-8a8b115bfaa929aec56a79acd4ac9ed462e41d5b.zip
added hasTextContent() to XsdTypeDefinition
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlValueMapping.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdComplexTypeDefinition.java6
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSimpleTypeDefinition.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdTypeDefinition.java2
4 files changed, 14 insertions, 4 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlValueMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlValueMapping.java
index 185aa96b50..be352f4c52 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlValueMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlValueMapping.java
@@ -18,11 +18,9 @@ import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages;
import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages;
import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation;
-import org.eclipse.jpt.jaxb.core.xsd.XsdComplexTypeDefinition;
import org.eclipse.jpt.jaxb.core.xsd.XsdTypeDefinition;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.xsd.XSDContentTypeCategory;
public class GenericJavaXmlValueMapping
extends AbstractJavaXmlNodeMapping<XmlValueAnnotation>
@@ -67,8 +65,7 @@ public class GenericJavaXmlValueMapping
return;
}
- if (! (xsdClassType.getKind() == XsdTypeDefinition.Kind.SIMPLE
- || ((XsdComplexTypeDefinition) xsdClassType).getXSDComponent().getContentTypeCategory() == XSDContentTypeCategory.SIMPLE_LITERAL)) {
+ if (! xsdClassType.hasTextContent()) {
messages.add(
DefaultValidationMessages.buildMessage(
IMessage.HIGH_SEVERITY,
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdComplexTypeDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdComplexTypeDefinition.java
index 8bce889fe3..2102907758 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdComplexTypeDefinition.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdComplexTypeDefinition.java
@@ -15,6 +15,7 @@ import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.xsd.XSDAttributeUse;
import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDContentTypeCategory;
import org.eclipse.xsd.XSDElementDeclaration;
@@ -32,6 +33,11 @@ public class XsdComplexTypeDefinition
}
@Override
+ public boolean hasTextContent() {
+ return getXSDComponent().getContentTypeCategory() == XSDContentTypeCategory.SIMPLE_LITERAL;
+ }
+
+ @Override
public XsdAttributeUse getAttribute(String namespace, String name) {
for (XsdAttributeUse attrUse : getAttributeUses(namespace)) {
if (attrUse.getXSDComponent().getAttributeDeclaration().getName().equals(name)) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSimpleTypeDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSimpleTypeDefinition.java
index e87653b990..ee467ba76f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSimpleTypeDefinition.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSimpleTypeDefinition.java
@@ -33,6 +33,11 @@ public class XsdSimpleTypeDefinition
}
@Override
+ public boolean hasTextContent() {
+ return true;
+ }
+
+ @Override
public boolean typeIsValid(XsdTypeDefinition xsdType, boolean isItemType, boolean allowExtension, boolean allowRestriction) {
if (isItemType) {
XsdSimpleTypeDefinition itemType = getItemType();
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdTypeDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdTypeDefinition.java
index da2bace75d..ea01a47c96 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdTypeDefinition.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdTypeDefinition.java
@@ -47,6 +47,8 @@ public abstract class XsdTypeDefinition<A extends XSDTypeDefinition>
return getXSDComponent().getName();
}
+ public abstract boolean hasTextContent();
+
public boolean matches(String namespace, String name) {
return XsdUtil.namespaceEquals(getXSDComponent(), namespace) && StringTools.stringsAreEqual(getName(), name);
}

Back to the top