1 | /* |
2 | * Copyright 2007, IPD, SDQ, University of Karlsruhe |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.repository.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.repository.edit.policies.BasicComponentSEFFCompartmentCanonicalEditPolicy; |
17 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.policies.BasicComponentSEFFCompartmentItemSemanticEditPolicy; |
18 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.policies.OpenSeffDiagramEditPolicy; |
19 | import de.uka.ipd.sdq.pcm.gmf.repository.part.Messages; |
20 | |
21 | /** |
22 | * @generated |
23 | */ |
24 | public class BasicComponentSEFFCompartmentEditPart extends |
25 | ListCompartmentEditPart { |
26 | |
27 | /** |
28 | * @generated |
29 | */ |
30 | public static final int VISUAL_ID = 7102; |
31 | |
32 | /** |
33 | * @generated |
34 | */ |
35 | public BasicComponentSEFFCompartmentEditPart(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.BasicComponentSEFFCompartmentEditPart_title; |
51 | } |
52 | |
53 | /** |
54 | * @generated |
55 | */ |
56 | public IFigure createFigure() { |
57 | ResizableCompartmentFigure result = (ResizableCompartmentFigure) super |
58 | .createFigure(); |
59 | result.setTitleVisibility(false); |
60 | return result; |
61 | } |
62 | |
63 | /** |
64 | * @generated |
65 | */ |
66 | protected void createDefaultEditPolicies() { |
67 | super.createDefaultEditPolicies(); |
68 | installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, |
69 | new BasicComponentSEFFCompartmentItemSemanticEditPolicy()); |
70 | installEditPolicy(EditPolicyRoles.CREATION_ROLE, |
71 | new CreationEditPolicy()); |
72 | installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, |
73 | new DragDropEditPolicy()); |
74 | installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, |
75 | new BasicComponentSEFFCompartmentCanonicalEditPolicy()); |
76 | } |
77 | |
78 | /** |
79 | * @generated |
80 | */ |
81 | protected void setRatio(Double ratio) { |
82 | if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { |
83 | super.setRatio(ratio); |
84 | } |
85 | } |
86 | |
87 | } |