use of org.eclipse.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller 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.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller 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.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller 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.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller in project webtools.sourceediting by eclipse.
the class ModelGroupDefinitionReferenceEditPart method getModelChildren.
protected List getModelChildren() {
List list = new ArrayList();
XSDModelGroupDefinitionAdapter adapter = (XSDModelGroupDefinitionAdapter) getModel();
XSDModelGroupDefinition groupDef = ((XSDModelGroupDefinition) adapter.getTarget());
XSDModelGroupDefinition resolvedGroupDef = groupDef.getResolvedModelGroupDefinition();
XSDModelGroup xsdModelGroup = resolvedGroupDef.getModelGroup();
ArrayList listOfVisibleGroupRefs = new ArrayList();
for (EditPart ep = getParent(); ep != null; ) {
Object object = ep.getModel();
if (object instanceof XSDModelGroupDefinitionAdapter) {
Object model = ((XSDModelGroupDefinitionAdapter) object).getTarget();
if (model instanceof XSDModelGroupDefinition) {
listOfVisibleGroupRefs.add(((XSDModelGroupDefinition) model).getResolvedModelGroupDefinition());
}
}
ep = ep.getParent();
}
boolean isCyclic = (listOfVisibleGroupRefs.contains(resolvedGroupDef));
if (xsdModelGroup != null && !isCyclic)
list.add(XSDAdapterFactory.getInstance().adapt(xsdModelGroup));
if (isCyclic)
list.add(new TargetConnectionSpaceFiller(null));
return list;
}
Aggregations