Search in sources :

Example 1 with AssociationViewAdapter

use of org.hibernate.eclipse.graph.model.AssociationViewAdapter in project jbosstools-hibernate by jbosstools.

the class AssociationEditPart method createFigure.

protected IFigure createFigure() {
    PolylineConnection polylineConnection = new PolylineConnection();
    AssociationViewAdapter association = (AssociationViewAdapter) getModel();
    polylineConnection.setTargetDecoration(association.getTargetDecoration());
    ConnectionRouter connectionRouter = association.getConnectionRouter();
    if (connectionRouter != null) {
        polylineConnection.setConnectionRouter(connectionRouter);
    }
    AssociationViewAdapter ava = (AssociationViewAdapter) getModel();
    if (ava.getAssociationName() != null) {
        MidpointLocator mpl = new MidpointLocator(polylineConnection, 0);
        polylineConnection.add(new Label(ava.getAssociationName()), mpl);
    }
    polylineConnection.setForegroundColor(ColorConstants.gray);
    return polylineConnection;
}
Also used : MidpointLocator(org.eclipse.draw2d.MidpointLocator) Label(org.eclipse.draw2d.Label) ConnectionRouter(org.eclipse.draw2d.ConnectionRouter) PolylineConnection(org.eclipse.draw2d.PolylineConnection) AssociationViewAdapter(org.hibernate.eclipse.graph.model.AssociationViewAdapter)

Aggregations

ConnectionRouter (org.eclipse.draw2d.ConnectionRouter)1 Label (org.eclipse.draw2d.Label)1 MidpointLocator (org.eclipse.draw2d.MidpointLocator)1 PolylineConnection (org.eclipse.draw2d.PolylineConnection)1 AssociationViewAdapter (org.hibernate.eclipse.graph.model.AssociationViewAdapter)1