Search in sources :

Example 1 with CenteredConnectionAnchor

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

the class ModelGroupDefinitionReferenceEditPart method createConnectionFigure.

public ReferenceConnection createConnectionFigure(BaseEditPart child) {
    ReferenceConnection connectionFigure = new ReferenceConnection();
    connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(((GenericGroupFigure) getFigure()).getIconFigure(), CenteredConnectionAnchor.RIGHT, 0, 0));
    if (child instanceof ModelGroupEditPart) {
        connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((ModelGroupEditPart) child).getTargetFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
    } else // for the cyclic group references
    {
        connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((GenericGroupFigure) getFigure()).getIconFigure(), CenteredConnectionAnchor.RIGHT, 0, 0));
    }
    connectionFigure.setHighlight(false);
    return connectionFigure;
}
Also used : CenteredConnectionAnchor(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor) GenericGroupFigure(org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure)

Example 2 with CenteredConnectionAnchor

use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor 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)

Example 3 with CenteredConnectionAnchor

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

the class AttributeGroupDefinitionEditPart method createConnectionFigure.

public ReferenceConnection createConnectionFigure(BaseEditPart child) {
    ReferenceConnection connectionFigure = new ReferenceConnection();
    connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(((GenericGroupFigure) getFigure()).getIconFigure(), CenteredConnectionAnchor.RIGHT, 0, 0));
    if (child instanceof AttributeGroupDefinitionEditPart) {
        connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((AttributeGroupDefinitionEditPart) child).getTargetFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
    } else if (child instanceof TargetConnectionSpacingFigureEditPart) {
        // TargetConnectionSpacingFigureEditPart elem = (TargetConnectionSpacingFigureEditPart) child;
        connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((TargetConnectionSpacingFigureEditPart) child).getFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
    }
    connectionFigure.setHighlight(false);
    figure = connectionFigure;
    return connectionFigure;
}
Also used : CenteredConnectionAnchor(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor) GenericGroupFigure(org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure)

Example 4 with CenteredConnectionAnchor

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

the class ModelGroupEditPart method createConnectionFigure.

public ReferenceConnection createConnectionFigure(BaseEditPart child) {
    ReferenceConnection connectionFigure = new ReferenceConnection();
    GenericGroupFigure modelGroupFigure = (GenericGroupFigure) getFigure();
    connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(modelGroupFigure.getIconFigure(), CenteredConnectionAnchor.RIGHT, 0, 0));
    if (child instanceof ModelGroupEditPart) {
        connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((ModelGroupEditPart) child).getTargetFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
    } else if (child instanceof TargetConnectionSpacingFigureEditPart) {
        TargetConnectionSpacingFigureEditPart elem = (TargetConnectionSpacingFigureEditPart) child;
        connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(elem.getFigure(), CenteredConnectionAnchor.LEFT, 0, 1));
    } else if (child instanceof ModelGroupDefinitionReferenceEditPart) {
        ModelGroupDefinitionReferenceEditPart elem = (ModelGroupDefinitionReferenceEditPart) child;
        connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(elem.getFigure(), CenteredConnectionAnchor.LEFT, 0, 1));
    }
    connectionFigure.setHighlight(false);
    return connectionFigure;
}
Also used : GenericGroupFigure(org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure) CenteredConnectionAnchor(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor)

Aggregations

CenteredConnectionAnchor (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor)4 GenericGroupFigure (org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure)3 ManhattanConnectionRouter (org.eclipse.draw2d.ManhattanConnectionRouter)1 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)1 XSDSimpleTypeDefinitionAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter)1 TypeReferenceConnection (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.TypeReferenceConnection)1 IType (org.eclipse.wst.xsd.ui.internal.adt.facade.IType)1