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.gef.EditPolicy; |
9 | import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart; |
10 | import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart; |
11 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; |
12 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy; |
13 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; |
14 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy; |
15 | import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; |
16 | import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; |
17 | import org.eclipse.gmf.runtime.notation.View; |
18 | |
19 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.policies.EventGroupEventTypeListCanonicalEditPolicy; |
20 | import de.uka.ipd.sdq.pcm.gmf.repository.edit.policies.EventGroupEventTypeListItemSemanticEditPolicy; |
21 | import de.uka.ipd.sdq.pcm.gmf.repository.part.Messages; |
22 | |
23 | /** |
24 | * @generated |
25 | */ |
26 | public class EventGroupEventTypeListEditPart extends ListCompartmentEditPart { |
27 | |
28 | /** |
29 | * @generated |
30 | */ |
31 | public static final int VISUAL_ID = 7107; |
32 | |
33 | /** |
34 | * @generated |
35 | */ |
36 | public EventGroupEventTypeListEditPart(View view) { |
37 | super(view); |
38 | } |
39 | |
40 | /** |
41 | * @generated |
42 | */ |
43 | protected boolean hasModelChildrenChanged(Notification evt) { |
44 | return false; |
45 | } |
46 | |
47 | /** |
48 | * @generated |
49 | */ |
50 | public String getCompartmentName() { |
51 | return Messages.EventGroupEventTypeListEditPart_title; |
52 | } |
53 | |
54 | /** |
55 | * @generated |
56 | */ |
57 | public IFigure createFigure() { |
58 | ResizableCompartmentFigure result = (ResizableCompartmentFigure) super |
59 | .createFigure(); |
60 | result.setTitleVisibility(false); |
61 | return result; |
62 | } |
63 | |
64 | /** |
65 | * @generated |
66 | */ |
67 | protected void createDefaultEditPolicies() { |
68 | super.createDefaultEditPolicies(); |
69 | installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, |
70 | new ResizableCompartmentEditPolicy()); |
71 | installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, |
72 | new EventGroupEventTypeListItemSemanticEditPolicy()); |
73 | installEditPolicy(EditPolicyRoles.CREATION_ROLE, |
74 | new CreationEditPolicy()); |
75 | installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, |
76 | new DragDropEditPolicy()); |
77 | installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, |
78 | new EventGroupEventTypeListCanonicalEditPolicy()); |
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 | } |