use of org.eclipse.xsd.XSDParticle in project webtools.sourceediting by eclipse.
the class XSDVisitor method visitComplexTypeDefinition.
public void visitComplexTypeDefinition(XSDComplexTypeDefinition type) {
XSDComplexTypeContent complexContent = type.getContent();
if (complexContent != null) {
if (complexContent instanceof XSDSimpleTypeDefinition) {
visitSimpleTypeDefinition((XSDSimpleTypeDefinition) complexContent);
} else if (complexContent instanceof XSDParticle) {
visitParticle((XSDParticle) complexContent);
}
}
if (type.getAttributeContents() != null) {
for (Iterator iter = type.getAttributeContents().iterator(); iter.hasNext(); ) {
XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent) iter.next();
if (attrGroupContent instanceof XSDAttributeUse) {
XSDAttributeUse attrUse = (XSDAttributeUse) attrGroupContent;
visitAttributeDeclaration(attrUse.getContent());
} else if (attrGroupContent instanceof XSDAttributeGroupDefinition) {
visitAttributeGroupDefinition((XSDAttributeGroupDefinition) attrGroupContent);
}
}
}
}
use of org.eclipse.xsd.XSDParticle in project webtools.sourceediting by eclipse.
the class XSDVisitor method visitModelGroup.
public void visitModelGroup(XSDModelGroup modelGroup) {
if (modelGroup.getContents() != null) {
for (Iterator iterator = modelGroup.getContents().iterator(); iterator.hasNext(); ) {
XSDParticle particle = (XSDParticle) iterator.next();
visitParticle(particle);
}
}
}
use of org.eclipse.xsd.XSDParticle in project webtools.sourceediting by eclipse.
the class XSDWildcardAdapter method getText.
public String getText() {
XSDWildcard xsdWildcard = (XSDWildcard) target;
StringBuffer result = new StringBuffer();
Element element = xsdWildcard.getElement();
if (element != null) {
result.append(element.getNodeName());
boolean hasMinOccurs = element.hasAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
boolean hasMaxOccurs = element.hasAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
if (hasMinOccurs || hasMaxOccurs) {
// $NON-NLS-1$
result.append(" [");
if (hasMinOccurs) {
int min = ((XSDParticle) xsdWildcard.getContainer()).getMinOccurs();
if (min == XSDParticle.UNBOUNDED) {
// $NON-NLS-1$
result.append("*");
} else {
result.append(String.valueOf(min));
}
} else // print default
{
int min = ((XSDParticle) xsdWildcard.getContainer()).getMinOccurs();
result.append(String.valueOf(min));
}
if (hasMaxOccurs) {
int max = ((XSDParticle) xsdWildcard.getContainer()).getMaxOccurs();
// $NON-NLS-1$
result.append("..");
if (max == XSDParticle.UNBOUNDED) {
// $NON-NLS-1$
result.append("*");
} else {
result.append(String.valueOf(max));
}
} else // print default
{
// $NON-NLS-1$
result.append("..");
int max = ((XSDParticle) xsdWildcard.getContainer()).getMaxOccurs();
result.append(String.valueOf(max));
}
// $NON-NLS-1$
result.append("]");
}
}
return result.toString();
}
use of org.eclipse.xsd.XSDParticle in project webtools.sourceediting by eclipse.
the class ModelGroupEditPart method getModelChildren.
protected List getModelChildren() {
// XSDModelGroupAdapter modelGroupAdapter = (XSDModelGroupAdapter)getModel();
// ArrayList ch = new ArrayList();
// ITreeElement [] tree = modelGroupAdapter.getChildren();
// int length = tree.length;
// for (int i = 0; i < length; i++)
// {
// ch.add(tree[i]);
// }
List list = new ArrayList();
XSDModelGroup xsdModelGroup = getXSDModelGroup();
for (Iterator i = xsdModelGroup.getContents().iterator(); i.hasNext(); ) {
XSDParticle next = (XSDParticle) i.next();
if (next.getContent() instanceof XSDElementDeclaration) {
XSDElementDeclaration elementDeclaration = (XSDElementDeclaration) next.getContent();
Adapter adapter = XSDAdapterFactory.getInstance().adapt(elementDeclaration);
list.add(new TargetConnectionSpaceFiller((XSDBaseAdapter) adapter));
}
if (next.getContent() instanceof XSDModelGroupDefinition) {
XSDModelGroupDefinition def = (XSDModelGroupDefinition) next.getContent();
Adapter adapter = XSDAdapterFactory.getInstance().adapt(def);
list.add(adapter);
} else if (next.getTerm() instanceof XSDModelGroup) {
XSDModelGroup modelGroup = (XSDModelGroup) next.getTerm();
Adapter adapter = XSDAdapterFactory.getInstance().adapt(modelGroup);
list.add(adapter);
} else if (next.getTerm() instanceof XSDWildcard) {
XSDWildcard wildCard = (XSDWildcard) next.getTerm();
Adapter adapter = XSDAdapterFactory.getInstance().adapt(wildCard);
list.add(new TargetConnectionSpaceFiller((XSDBaseAdapter) adapter));
}
}
if (list.size() == 0)
list.add(new TargetConnectionSpaceFiller(null));
return list;
// return ch;
}
use of org.eclipse.xsd.XSDParticle in project tmdm-studio-se by Talend.
the class ComplexTypeConfigComposite method initUIContentsInGroup.
private void initUIContentsInGroup() {
XSDParticle groupParticle = (XSDParticle) complexType.getContent();
XSDModelGroup group = (XSDModelGroup) groupParticle.getContent();
radGroupAll.setSelection(XSDCompositor.ALL_LITERAL.equals(group.getCompositor()));
radGroupSequence.setSelection(XSDCompositor.SEQUENCE_LITERAL.equals(group.getCompositor()));
radGroupChoice.setSelection(XSDCompositor.CHOICE_LITERAL.equals(group.getCompositor()));
}
Aggregations