Search in sources :

Example 1 with TargetConnectionSpacingFigureEditPart

use of org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart in project webtools.sourceediting by eclipse.

the class XSDAttributeDragAndDropCommand method calculateAttributeGroupList.

// Attribute Group related helper method
protected void calculateAttributeGroupList() {
    EditPart editPart = target;
    while (editPart != null) {
        if (editPart instanceof ComplexTypeEditPart) {
            List list = editPart.getChildren();
            for (Iterator i = list.iterator(); i.hasNext(); ) {
                Object child = i.next();
                if (child instanceof CompartmentEditPart) {
                    List compartmentList = ((CompartmentEditPart) child).getChildren();
                    for (Iterator it = compartmentList.iterator(); it.hasNext(); ) {
                        Object obj = it.next();
                        if (obj instanceof XSDAttributesForAnnotationEditPart) {
                            XSDAttributesForAnnotationEditPart groups = (XSDAttributesForAnnotationEditPart) obj;
                            List groupList = groups.getChildren();
                            for (Iterator iter = groupList.iterator(); iter.hasNext(); ) {
                                Object groupChild = iter.next();
                                if (groupChild instanceof TargetConnectionSpacingFigureEditPart) {
                                    targetSpacesList.add(groupChild);
                                } else if (groupChild instanceof AttributeGroupDefinitionEditPart) {
                                    getAttributeGroupEditParts((AttributeGroupDefinitionEditPart) groupChild);
                                }
                            }
                        }
                    }
                }
            }
        }
        editPart = editPart.getParent();
    }
}
Also used : ComplexTypeEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ComplexTypeEditPart) AttributeGroupDefinitionEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.AttributeGroupDefinitionEditPart) TargetConnectionSpacingFigureEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart) XSDBaseFieldEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.XSDBaseFieldEditPart) ComplexTypeEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ComplexTypeEditPart) CompartmentEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CompartmentEditPart) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) BaseFieldEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart) AttributeGroupDefinitionEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.AttributeGroupDefinitionEditPart) EditPart(org.eclipse.gef.EditPart) XSDAttributesForAnnotationEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.XSDAttributesForAnnotationEditPart) Iterator(java.util.Iterator) CompartmentEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CompartmentEditPart) ArrayList(java.util.ArrayList) List(java.util.List) TargetConnectionSpacingFigureEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart) XSDAttributesForAnnotationEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.XSDAttributesForAnnotationEditPart)

Example 2 with TargetConnectionSpacingFigureEditPart

use of org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart in project webtools.sourceediting by eclipse.

the class XSDAttributeDragAndDropCommand method getAttributeGroupEditParts.

// Attribute Group related helper method
protected List getAttributeGroupEditParts(AttributeGroupDefinitionEditPart attributeGroupEditPart) {
    List groupList = new ArrayList();
    List list = attributeGroupEditPart.getChildren();
    for (Iterator i = list.iterator(); i.hasNext(); ) {
        Object object = i.next();
        if (object instanceof TargetConnectionSpacingFigureEditPart) {
            targetSpacesList.add(object);
        } else if (object instanceof AttributeGroupDefinitionEditPart) {
            AttributeGroupDefinitionEditPart groupRef = (AttributeGroupDefinitionEditPart) object;
            List groupRefChildren = groupRef.getChildren();
            for (Iterator it = groupRefChildren.iterator(); it.hasNext(); ) {
                Object o = it.next();
                if (o instanceof TargetConnectionSpacingFigureEditPart) {
                    targetSpacesList.add(o);
                } else if (o instanceof AttributeGroupDefinitionEditPart) {
                    AttributeGroupDefinitionEditPart aGroup = (AttributeGroupDefinitionEditPart) o;
                    groupList.add(aGroup);
                    groupList.addAll(getAttributeGroupEditParts(aGroup));
                }
            }
        }
    }
    return groupList;
}
Also used : AttributeGroupDefinitionEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.AttributeGroupDefinitionEditPart) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) TargetConnectionSpacingFigureEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart)

Example 3 with TargetConnectionSpacingFigureEditPart

use of org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart in project webtools.sourceediting by eclipse.

the class BaseDragAndDropCommand method handleOtherTargets.

protected void handleOtherTargets(int index) {
    int in = 0;
    ConnectableEditPart previousModelEditPart = null;
    for (Iterator i = targetSpacesList.iterator(); i.hasNext(); ) {
        Object o = i.next();
        previousModelEditPart = parentEditPart;
        TargetConnectionSpacingFigureEditPart sp = (TargetConnectionSpacingFigureEditPart) o;
        if (sp.getParent() instanceof ConnectableEditPart)
            parentEditPart = (ConnectableEditPart) sp.getParent();
        else
            parentEditPart = null;
        in++;
        if (in > index) {
            if (closerSibling == ABOVE_IS_CLOSER) {
                parentEditPart = previousModelEditPart;
            }
            break;
        }
    }
}
Also used : ConnectableEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.ConnectableEditPart) Iterator(java.util.Iterator) TargetConnectionSpacingFigureEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart) Point(org.eclipse.draw2d.geometry.Point)

Example 4 with TargetConnectionSpacingFigureEditPart

use of org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart in project webtools.sourceediting by eclipse.

the class XSDElementDragAndDropCommand method getModelGroupEditParts.

// Model Group related helper method
protected List getModelGroupEditParts(ModelGroupEditPart modelGroupEditPart) {
    List modelGroupList = new ArrayList();
    List list = modelGroupEditPart.getChildren();
    for (Iterator i = list.iterator(); i.hasNext(); ) {
        Object object = i.next();
        if (object instanceof TargetConnectionSpacingFigureEditPart) {
            targetSpacesList.add(object);
        } else if (object instanceof ModelGroupDefinitionReferenceEditPart) {
            ModelGroupDefinitionReferenceEditPart groupRef = (ModelGroupDefinitionReferenceEditPart) object;
            List groupRefChildren = groupRef.getChildren();
            for (Iterator it = groupRefChildren.iterator(); it.hasNext(); ) {
                Object o = it.next();
                if (o instanceof ModelGroupEditPart) {
                    getModelGroupEditParts((ModelGroupEditPart) o);
                }
            }
        } else if (object instanceof ModelGroupEditPart) {
            getModelGroupEditParts((ModelGroupEditPart) object);
        }
    }
    return modelGroupList;
}
Also used : ModelGroupDefinitionReferenceEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.ModelGroupDefinitionReferenceEditPart) ModelGroupEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.ModelGroupEditPart) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) TargetConnectionSpacingFigureEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart)

Aggregations

Iterator (java.util.Iterator)4 TargetConnectionSpacingFigureEditPart (org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 AttributeGroupDefinitionEditPart (org.eclipse.wst.xsd.ui.internal.design.editparts.AttributeGroupDefinitionEditPart)2 Point (org.eclipse.draw2d.geometry.Point)1 EditPart (org.eclipse.gef.EditPart)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 BaseFieldEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart)1 CompartmentEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CompartmentEditPart)1 ComplexTypeEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ComplexTypeEditPart)1 ConnectableEditPart (org.eclipse.wst.xsd.ui.internal.design.editparts.ConnectableEditPart)1 ModelGroupDefinitionReferenceEditPart (org.eclipse.wst.xsd.ui.internal.design.editparts.ModelGroupDefinitionReferenceEditPart)1 ModelGroupEditPart (org.eclipse.wst.xsd.ui.internal.design.editparts.ModelGroupEditPart)1 XSDAttributesForAnnotationEditPart (org.eclipse.wst.xsd.ui.internal.design.editparts.XSDAttributesForAnnotationEditPart)1 XSDBaseFieldEditPart (org.eclipse.wst.xsd.ui.internal.design.editparts.XSDBaseFieldEditPart)1