Search in sources :

Example 6 with IType

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IType in project webtools.sourceediting by eclipse.

the class ComplexTypeEditPart method createConnectionFigure.

public TypeReferenceConnection createConnectionFigure() {
    connectionFigure = null;
    IComplexType complexType = (IComplexType) getModel();
    IType type = complexType.getSuperType();
    if (type != null) {
        AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getTargetEditPart(type);
        if (referenceTypePart != null) {
            connectionFigure = new TypeReferenceConnection(true);
            // draw a line out from the top
            connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.TOP, 1));
            // TODO (cs) need to draw the target anchor to look like a UML inheritance relationship
            // adding a label to the connection would help to
            connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.BOTTOM, 0, 0));
            connectionFigure.setConnectionRouter(new ManhattanConnectionRouter());
            ((CenteredConnectionAnchor) connectionFigure.getSourceAnchor()).setOther((CenteredConnectionAnchor) connectionFigure.getTargetAnchor());
            connectionFigure.setHighlight(false);
        }
    }
    return connectionFigure;
}
Also used : AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) ManhattanConnectionRouter(org.eclipse.draw2d.ManhattanConnectionRouter) IComplexType(org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType) IType(org.eclipse.wst.xsd.ui.internal.adt.facade.IType)

Example 7 with IType

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IType in project webtools.sourceediting by eclipse.

the class FocusTypeColumn method getChildren.

public List getChildren() {
    List result = new ArrayList();
    if (model instanceof IType) {
        IType type = (IType) model;
        if (type.getSuperType() != null) {
            result.add(type.getSuperType());
        }
        result.add(type);
    } else if (model instanceof IField || model instanceof IStructure) {
        result.add(model);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) IStructure(org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) IType(org.eclipse.wst.xsd.ui.internal.adt.facade.IType)

Example 8 with IType

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IType in project webtools.sourceediting by eclipse.

the class RootContentEditPart method getModelChildren.

protected List getModelChildren() {
    collections = new ArrayList();
    if (getModel() != null) {
        Object obj = getModel();
        IADTObject focusObject = null;
        if (obj instanceof IStructure) {
            if (obj instanceof IGraphElement) {
                if (((IGraphElement) obj).isFocusAllowed())
                    focusObject = (IStructure) obj;
            }
        } else if (obj instanceof IField) {
            focusObject = (IField) obj;
        } else if (obj instanceof IModel) {
            focusObject = (IModel) obj;
            collections.add(focusObject);
            return collections;
        } else if (obj instanceof IType) {
            if (obj instanceof IGraphElement) {
                if (((IGraphElement) obj).isFocusAllowed()) {
                    focusObject = (IType) obj;
                }
            }
        } else if (obj instanceof IGraphElement) {
            if (((IGraphElement) obj).isFocusAllowed()) {
                focusObject = (IADTObject) obj;
                collections.add(focusObject);
                return collections;
            }
        }
        if (focusObject != null) {
            RootHolder holder = new RootHolder(focusObject);
            collections.add(holder);
            return collections;
        }
    }
    return collections;
}
Also used : IModel(org.eclipse.wst.xsd.ui.internal.adt.facade.IModel) IGraphElement(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) ArrayList(java.util.ArrayList) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) IStructure(org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) RootHolder(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder) IType(org.eclipse.wst.xsd.ui.internal.adt.facade.IType)

Aggregations

IType (org.eclipse.wst.xsd.ui.internal.adt.facade.IType)8 IField (org.eclipse.wst.xsd.ui.internal.adt.facade.IField)6 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)4 ArrayList (java.util.ArrayList)3 IStructure (org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure)3 List (java.util.List)2 ManhattanConnectionRouter (org.eclipse.draw2d.ManhattanConnectionRouter)2 Iterator (java.util.Iterator)1 Point (org.eclipse.draw2d.geometry.Point)1 EditPart (org.eclipse.gef.EditPart)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 XSDSimpleTypeDefinitionAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter)1 CenteredConnectionAnchor (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor)1 TypeReferenceConnection (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.TypeReferenceConnection)1 IGraphElement (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement)1 RootHolder (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder)1 IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)1 IComplexType (org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType)1 IModel (org.eclipse.wst.xsd.ui.internal.adt.facade.IModel)1 ConnectableEditPart (org.eclipse.wst.xsd.ui.internal.design.editparts.ConnectableEditPart)1