Search in sources :

Example 1 with Annotation

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

the class XSDGroupsForAnnotationEditPart method getModelChildren.

protected List getModelChildren() {
    List xsdModelGroupList = new ArrayList();
    List adapterList = new ArrayList();
    IStructure structure = ((Annotation) getModel()).getOwner();
    if (structure instanceof IComplexType) {
        complexType = (IComplexType) structure;
        if (complexType instanceof XSDComplexTypeDefinitionAdapter) {
            XSDComplexTypeDefinitionAdapter adapter = (XSDComplexTypeDefinitionAdapter) complexType;
            xsdModelGroupList = adapter.getModelGroups();
        }
        for (Iterator i = xsdModelGroupList.iterator(); i.hasNext(); ) {
            Object obj = i.next();
            if (obj instanceof XSDModelGroup) {
                adapterList.add(XSDAdapterFactory.getInstance().adapt((XSDModelGroup) obj));
            } else if (obj instanceof XSDModelGroupDefinition) {
                adapterList.add(XSDAdapterFactory.getInstance().adapt((XSDModelGroupDefinition) obj));
            }
        }
    } else if (structure instanceof XSDModelGroupDefinitionAdapter) {
        XSDModelGroupDefinitionAdapter adapter = (XSDModelGroupDefinitionAdapter) structure;
        XSDModelGroup group = adapter.getXSDModelGroupDefinition().getModelGroup();
        if (group != null) {
            adapterList.add(XSDAdapterFactory.getInstance().adapt(group));
        }
    }
    return adapterList;
}
Also used : XSDComplexTypeDefinitionAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDComplexTypeDefinitionAdapter) XSDModelGroup(org.eclipse.xsd.XSDModelGroup) XSDModelGroupDefinitionAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupDefinitionAdapter) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) IStructure(org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition) Annotation(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Annotation) IComplexType(org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType)

Example 2 with Annotation

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

the class CompartmentEditPart method removeChildVisual.

protected void removeChildVisual(EditPart childEditPart) {
    Object model = childEditPart.getModel();
    IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
    if (model instanceof IField) {
        getCompartmentFigure().getContentPane().remove(child);
        return;
    } else if (model instanceof Annotation) {
        getCompartmentFigure().getAnnotationPane().remove(child);
        return;
    }
    super.removeChildVisual(childEditPart);
}
Also used : IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) Annotation(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Annotation) IFigure(org.eclipse.draw2d.IFigure)

Example 3 with Annotation

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

the class CompartmentEditPart method addChildVisual.

protected void addChildVisual(EditPart childEditPart, int index) {
    Object model = childEditPart.getModel();
    IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
    if (model instanceof IField) {
        getCompartmentFigure().getContentPane().add(child, index);
        return;
    } else if (model instanceof Annotation) {
        getCompartmentFigure().getAnnotationPane().add(child);
        return;
    }
    super.addChildVisual(childEditPart, index);
}
Also used : IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) Annotation(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Annotation) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

Annotation (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Annotation)3 IFigure (org.eclipse.draw2d.IFigure)2 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)2 IField (org.eclipse.wst.xsd.ui.internal.adt.facade.IField)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 XSDComplexTypeDefinitionAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDComplexTypeDefinitionAdapter)1 XSDModelGroupDefinitionAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupDefinitionAdapter)1 IComplexType (org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType)1 IStructure (org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure)1 XSDModelGroup (org.eclipse.xsd.XSDModelGroup)1 XSDModelGroupDefinition (org.eclipse.xsd.XSDModelGroupDefinition)1