1 | /* |
2 | * Copyright 2006 SDQ Research Group, University of Karlsruhe (TH) |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.seff.edit.parts; |
5 | |
6 | import org.eclipse.draw2d.Connection; |
7 | import org.eclipse.draw2d.PolylineDecoration; |
8 | import org.eclipse.draw2d.RotatableDecoration; |
9 | import org.eclipse.draw2d.geometry.PointList; |
10 | import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; |
11 | import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart; |
12 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; |
13 | import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; |
14 | import org.eclipse.gmf.runtime.notation.View; |
15 | |
16 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.policies.AbstractActionSuccessor_AbstractActionItemSemanticEditPolicy; |
17 | |
18 | /** |
19 | * @generated |
20 | */ |
21 | public class AbstractActionSuccessor_AbstractActionEditPart extends |
22 | ConnectionNodeEditPart implements ITreeBranchEditPart { |
23 | |
24 | /** |
25 | * @generated |
26 | */ |
27 | public static final int VISUAL_ID = 4001; |
28 | |
29 | /** |
30 | * @generated |
31 | */ |
32 | public AbstractActionSuccessor_AbstractActionEditPart(View view) { |
33 | super(view); |
34 | } |
35 | |
36 | /** |
37 | * @generated |
38 | */ |
39 | protected void createDefaultEditPolicies() { |
40 | super.createDefaultEditPolicies(); |
41 | installEditPolicy( |
42 | EditPolicyRoles.SEMANTIC_ROLE, |
43 | new AbstractActionSuccessor_AbstractActionItemSemanticEditPolicy()); |
44 | } |
45 | |
46 | /** |
47 | * Creates figure for this edit part. |
48 | * |
49 | * Body of this method does not depend on settings in generation model |
50 | * so you may safely remove <i>generated</i> tag and modify it. |
51 | * |
52 | * @generated |
53 | */ |
54 | protected Connection createConnectionFigure() { |
55 | return new ControlFlowConnectionFigure(); |
56 | } |
57 | |
58 | /** |
59 | * @generated |
60 | */ |
61 | public ControlFlowConnectionFigure getPrimaryShape() { |
62 | return (ControlFlowConnectionFigure) getFigure(); |
63 | } |
64 | |
65 | /** |
66 | * @generated |
67 | */ |
68 | public class ControlFlowConnectionFigure extends PolylineConnectionEx { |
69 | |
70 | /** |
71 | * @generated |
72 | */ |
73 | public ControlFlowConnectionFigure() { |
74 | this.setLineWidth(1); |
75 | |
76 | setTargetDecoration(createTargetDecoration()); |
77 | } |
78 | |
79 | /** |
80 | * @generated |
81 | */ |
82 | private RotatableDecoration createTargetDecoration() { |
83 | PolylineDecoration df = new PolylineDecoration(); |
84 | df.setLineWidth(1); |
85 | PointList pl = new PointList(); |
86 | pl.addPoint(getMapMode().DPtoLP(-1), getMapMode().DPtoLP(1)); |
87 | pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0)); |
88 | pl.addPoint(getMapMode().DPtoLP(-1), getMapMode().DPtoLP(-1)); |
89 | df.setTemplate(pl); |
90 | df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3)); |
91 | return df; |
92 | } |
93 | |
94 | } |
95 | |
96 | } |