1 | /* |
2 | * Copyright 2009, SDQ, IPD, Uni Karlsruhe (TH) |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.resource.edit.parts; |
5 | |
6 | import org.eclipse.draw2d.IFigure; |
7 | import org.eclipse.emf.common.notify.Notification; |
8 | import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart; |
9 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; |
10 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy; |
11 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; |
12 | import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; |
13 | import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; |
14 | import org.eclipse.gmf.runtime.notation.View; |
15 | |
16 | import de.uka.ipd.sdq.pcm.gmf.resource.edit.policies.LinkingResourceNetworkSwitchCompartmentCanonicalEditPolicy; |
17 | import de.uka.ipd.sdq.pcm.gmf.resource.edit.policies.LinkingResourceNetworkSwitchCompartmentItemSemanticEditPolicy; |
18 | import de.uka.ipd.sdq.pcm.gmf.resource.part.Messages; |
19 | |
20 | /** |
21 | * @generated |
22 | */ |
23 | public class LinkingResourceNetworkSwitchCompartmentEditPart extends |
24 | ListCompartmentEditPart { |
25 | |
26 | /** |
27 | * @generated |
28 | */ |
29 | public static final int VISUAL_ID = 7003; |
30 | |
31 | /** |
32 | * @generated |
33 | */ |
34 | public LinkingResourceNetworkSwitchCompartmentEditPart(View view) { |
35 | super(view); |
36 | } |
37 | |
38 | /** |
39 | * @generated |
40 | */ |
41 | protected boolean hasModelChildrenChanged(Notification evt) { |
42 | return false; |
43 | } |
44 | |
45 | /** |
46 | * @generated |
47 | */ |
48 | public String getCompartmentName() { |
49 | return Messages.LinkingResourceNetworkSwitchCompartmentEditPart_title; |
50 | } |
51 | |
52 | /** |
53 | * @generated NOT |
54 | */ |
55 | public IFigure createFigure() { |
56 | ResizableCompartmentFigure result = (ResizableCompartmentFigure) super |
57 | .createFigure(); |
58 | result.setTitleVisibility(false); |
59 | result.setBorder(null); // custom code: remove border |
60 | return result; |
61 | } |
62 | |
63 | /** |
64 | * @generated |
65 | */ |
66 | protected void createDefaultEditPolicies() { |
67 | super.createDefaultEditPolicies(); |
68 | installEditPolicy( |
69 | EditPolicyRoles.SEMANTIC_ROLE, |
70 | new LinkingResourceNetworkSwitchCompartmentItemSemanticEditPolicy()); |
71 | installEditPolicy(EditPolicyRoles.CREATION_ROLE, |
72 | new CreationEditPolicy()); |
73 | installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, |
74 | new DragDropEditPolicy()); |
75 | installEditPolicy( |
76 | EditPolicyRoles.CANONICAL_ROLE, |
77 | new LinkingResourceNetworkSwitchCompartmentCanonicalEditPolicy()); |
78 | } |
79 | |
80 | /** |
81 | * @generated |
82 | */ |
83 | protected void setRatio(Double ratio) { |
84 | if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { |
85 | super.setRatio(ratio); |
86 | } |
87 | } |
88 | |
89 | } |