01: package net.refractions.udig.printing.ui.internal.editor.parts;
02:
03: import net.refractions.udig.printing.model.Connection;
04: import net.refractions.udig.printing.ui.internal.editor.commands.ConnectionDeleteCommand;
05:
06: import org.eclipse.draw2d.Graphics;
07: import org.eclipse.draw2d.IFigure;
08: import org.eclipse.draw2d.PolygonDecoration;
09: import org.eclipse.draw2d.PolylineConnection;
10: import org.eclipse.gef.EditPolicy;
11: import org.eclipse.gef.commands.Command;
12: import org.eclipse.gef.editparts.AbstractConnectionEditPart;
13: import org.eclipse.gef.editpolicies.ConnectionEditPolicy;
14: import org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy;
15: import org.eclipse.gef.requests.GroupRequest;
16:
17: public class ConnectionPart extends AbstractConnectionEditPart {
18:
19: protected IFigure createFigure() {
20: PolylineConnection connection = (PolylineConnection) super
21: .createFigure();
22: connection.setTargetDecoration(new PolygonDecoration());
23: connection.setLineStyle(Graphics.LINE_SOLID);
24: return connection;
25: }
26:
27: protected void createEditPolicies() {
28: installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE,
29: new ConnectionEndpointEditPolicy());
30: installEditPolicy(EditPolicy.CONNECTION_ROLE,
31: new ConnectionEditPolicy() {
32: protected Command getDeleteCommand(
33: GroupRequest request) {
34: return new ConnectionDeleteCommand(
35: (Connection) getModel());
36: }
37: });
38: }
39: }
|