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