use of org.eclipse.xsd.XSDAttributeGroupContent in project webtools.sourceediting by eclipse.
the class XSDVisitorForFields method visitComplexTypeDefinition.
public void visitComplexTypeDefinition(XSDComplexTypeDefinition type) {
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());
// if (attrUse.getAttributeDeclaration() != attrUse.getContent())
// {
// visitAttributeDeclaration(attrUse.getContent());
// }
// else
// {
// thingsWeNeedToListenTo.add(attrUse.getAttributeDeclaration());
// concreteComponentList.add(attrUse.getAttributeDeclaration());
// }
} else if (attrGroupContent instanceof XSDAttributeGroupDefinition) {
XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) attrGroupContent;
thingsWeNeedToListenTo.add(attrGroup);
if (attrGroup.isAttributeGroupDefinitionReference()) {
attrGroup = attrGroup.getResolvedAttributeGroupDefinition();
visitAttributeGroupDefinition(attrGroup);
}
}
}
}
if (type.getAttributeWildcard() != null) {
thingsWeNeedToListenTo.add(type.getAttributeWildcard());
concreteComponentList.add(type.getAttributeWildcard());
}
super.visitComplexTypeDefinition(type);
}
use of org.eclipse.xsd.XSDAttributeGroupContent 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.XSDAttributeGroupContent in project webtools.sourceediting by eclipse.
the class AttributeGroupDefinitionEditPart method getModelChildren.
protected List getModelChildren() {
List list = new ArrayList();
XSDAttributeGroupDefinitionAdapter adapter = (XSDAttributeGroupDefinitionAdapter) getModel();
XSDAttributeGroupDefinition attributeGroupDefinition = adapter.getXSDAttributeGroupDefinition();
Iterator i = attributeGroupDefinition.getResolvedAttributeGroupDefinition().getContents().iterator();
while (i.hasNext()) {
XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent) i.next();
if (attrGroupContent instanceof XSDAttributeGroupDefinition) {
list.add(XSDAdapterFactory.getInstance().adapt(attrGroupContent));
} else if (attrGroupContent instanceof XSDAttributeUse) {
list.add(new TargetConnectionSpaceFiller((XSDBaseAdapter) XSDAdapterFactory.getInstance().adapt(((XSDAttributeUse) attrGroupContent).getAttributeDeclaration())));
} else {
list.add(new TargetConnectionSpaceFiller((XSDBaseAdapter) getModel()));
}
}
if (list.isEmpty()) {
list.add(new TargetConnectionSpaceFiller((XSDBaseAdapter) getModel()));
}
return list;
}
use of org.eclipse.xsd.XSDAttributeGroupContent in project webtools.sourceediting by eclipse.
the class XSDComplexTypeDefinitionAdapter method getAttributeGroupContent.
public List getAttributeGroupContent() {
EList attrContent = getXSDComplexTypeDefinition().getAttributeContents();
List attrUses = new ArrayList();
List list = new ArrayList();
for (Iterator it = attrContent.iterator(); it.hasNext(); ) {
XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent) it.next();
if (attrGroupContent instanceof XSDAttributeGroupDefinition) {
XSDAttributeGroupDefinition attributeGroupDefinition = (XSDAttributeGroupDefinition) attrGroupContent;
list.add(XSDAdapterFactory.getInstance().adapt(attributeGroupDefinition));
getAttributeUses(attributeGroupDefinition, attrUses);
} else {
attrUses.add(attrGroupContent);
list.add(new TargetConnectionSpaceFiller(this));
}
}
return list;
}
use of org.eclipse.xsd.XSDAttributeGroupContent in project webtools.sourceediting by eclipse.
the class MoveXSDAttributeAction method moveUnderXSDComplexTypeDefinition.
protected void moveUnderXSDComplexTypeDefinition(XSDComplexTypeDefinition complexType) {
int originalIndex = 0;
for (Iterator iterator = complexType.getAttributeContents().iterator(); iterator.hasNext(); ) {
XSDAttributeGroupContent attributeGroupContent = (XSDAttributeGroupContent) iterator.next();
if (attributeGroupContent instanceof XSDAttributeUse) {
XSDAttributeDeclaration attribute = ((XSDAttributeUse) attributeGroupContent).getContent();
if (attribute == selected) {
complexType.getAttributeContents().remove(attribute.getContainer());
break;
}
}
originalIndex++;
}
int index = 0;
boolean addedBack = false;
List attributeGroupContents = complexType.getAttributeContents();
for (Iterator iterator = attributeGroupContents.iterator(); iterator.hasNext(); ) {
XSDAttributeGroupContent attributeGroupContent = (XSDAttributeGroupContent) iterator.next();
if (attributeGroupContent instanceof XSDAttributeUse) {
XSDAttributeDeclaration attribute = ((XSDAttributeUse) attributeGroupContent).getContent();
if (insertType == INSERT_AFTER) {
if (attribute == previousRefComponent) {
complexType.getAttributeContents().add(index + 1, selected.getContainer());
addedBack = true;
break;
}
} else if (insertType == INSERT_BEFORE) {
if (attribute == nextRefComponent) {
complexType.getAttributeContents().add(index, selected.getContainer());
addedBack = true;
break;
}
}
}
index++;
}
if (attributeGroupContents.size() == 0) {
complexType.getAttributeContents().add(selected.getContainer());
addedBack = true;
}
if (!addedBack) {
complexType.getAttributeContents().add(originalIndex, selected.getContainer());
}
}
Aggregations