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