Search in sources :

Example 1 with TypeReferenceConnection

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

the class XSDSimpleTypeEditPart method createConnectionFigure.

public TypeReferenceConnection createConnectionFigure() {
    TypeReferenceConnection connectionFigure = null;
    XSDSimpleTypeDefinitionAdapter adapter = (XSDSimpleTypeDefinitionAdapter) getModel();
    IType superType = adapter.getSuperType();
    if (superType != null) {
        AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getTargetEditPart(superType);
        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 : XSDSimpleTypeDefinitionAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter) CenteredConnectionAnchor(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor) AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) ManhattanConnectionRouter(org.eclipse.draw2d.ManhattanConnectionRouter) TypeReferenceConnection(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.TypeReferenceConnection) IType(org.eclipse.wst.xsd.ui.internal.adt.facade.IType)

Aggregations

ManhattanConnectionRouter (org.eclipse.draw2d.ManhattanConnectionRouter)1 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)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 IType (org.eclipse.wst.xsd.ui.internal.adt.facade.IType)1