1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.seff.provider; |
7 | |
8 | |
9 | import java.util.Collection; |
10 | import java.util.List; |
11 | |
12 | import org.eclipse.emf.common.notify.AdapterFactory; |
13 | import org.eclipse.emf.common.notify.Notification; |
14 | import org.eclipse.emf.ecore.EStructuralFeature; |
15 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
16 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
17 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
18 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
19 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
20 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
21 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
22 | import org.eclipse.emf.edit.provider.ViewerNotification; |
23 | |
24 | import de.uka.ipd.sdq.pcm.parameter.ParameterFactory; |
25 | import de.uka.ipd.sdq.pcm.seff.EmitEventAction; |
26 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
27 | |
28 | /** |
29 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.seff.EmitEventAction} object. |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public class EmitEventActionItemProvider |
35 | extends AbstractActionItemProvider |
36 | implements |
37 | IEditingDomainItemProvider, |
38 | IStructuredItemContentProvider, |
39 | ITreeItemContentProvider, |
40 | IItemLabelProvider, |
41 | IItemPropertySource { |
42 | /** |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @generated |
46 | */ |
47 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
48 | |
49 | /** |
50 | * This constructs an instance from a factory and a notifier. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @generated |
54 | */ |
55 | public EmitEventActionItemProvider(AdapterFactory adapterFactory) { |
56 | super(adapterFactory); |
57 | } |
58 | |
59 | /** |
60 | * This returns the property descriptors for the adapted class. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @generated |
64 | */ |
65 | @Override |
66 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
67 | if (itemPropertyDescriptors == null) { |
68 | super.getPropertyDescriptors(object); |
69 | |
70 | addEventType__EmitEventActionPropertyDescriptor(object); |
71 | addSourceRole__EmitEventActionPropertyDescriptor(object); |
72 | } |
73 | return itemPropertyDescriptors; |
74 | } |
75 | |
76 | /** |
77 | * This adds a property descriptor for the Event Type Emit Event Action feature. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | protected void addEventType__EmitEventActionPropertyDescriptor(Object object) { |
83 | itemPropertyDescriptors.add |
84 | (createItemPropertyDescriptor |
85 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
86 | getResourceLocator(), |
87 | getString("_UI_EmitEventAction_eventType__EmitEventAction_feature"), |
88 | getString("_UI_PropertyDescriptor_description", "_UI_EmitEventAction_eventType__EmitEventAction_feature", "_UI_EmitEventAction_type"), |
89 | SeffPackage.Literals.EMIT_EVENT_ACTION__EVENT_TYPE_EMIT_EVENT_ACTION, |
90 | true, |
91 | false, |
92 | true, |
93 | null, |
94 | null, |
95 | null)); |
96 | } |
97 | |
98 | /** |
99 | * This adds a property descriptor for the Source Role Emit Event Action feature. |
100 | * <!-- begin-user-doc --> |
101 | * <!-- end-user-doc --> |
102 | * @generated |
103 | */ |
104 | protected void addSourceRole__EmitEventActionPropertyDescriptor(Object object) { |
105 | itemPropertyDescriptors.add |
106 | (createItemPropertyDescriptor |
107 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
108 | getResourceLocator(), |
109 | getString("_UI_EmitEventAction_sourceRole__EmitEventAction_feature"), |
110 | getString("_UI_PropertyDescriptor_description", "_UI_EmitEventAction_sourceRole__EmitEventAction_feature", "_UI_EmitEventAction_type"), |
111 | SeffPackage.Literals.EMIT_EVENT_ACTION__SOURCE_ROLE_EMIT_EVENT_ACTION, |
112 | true, |
113 | false, |
114 | true, |
115 | null, |
116 | null, |
117 | null)); |
118 | } |
119 | |
120 | /** |
121 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
122 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
123 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
124 | * <!-- begin-user-doc --> |
125 | * <!-- end-user-doc --> |
126 | * @generated |
127 | */ |
128 | @Override |
129 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
130 | if (childrenFeatures == null) { |
131 | super.getChildrenFeatures(object); |
132 | childrenFeatures.add(SeffPackage.Literals.CALL_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION); |
133 | } |
134 | return childrenFeatures; |
135 | } |
136 | |
137 | /** |
138 | * <!-- begin-user-doc --> |
139 | * <!-- end-user-doc --> |
140 | * @generated |
141 | */ |
142 | @Override |
143 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
144 | // Check the type of the specified child object and return the proper feature to use for |
145 | // adding (see {@link AddCommand}) it as a child. |
146 | |
147 | return super.getChildFeature(object, child); |
148 | } |
149 | |
150 | /** |
151 | * This returns EmitEventAction.gif. |
152 | * <!-- begin-user-doc --> |
153 | * <!-- end-user-doc --> |
154 | * @generated |
155 | */ |
156 | @Override |
157 | public Object getImage(Object object) { |
158 | return overlayImage(object, getResourceLocator().getImage("full/obj16/EmitEventAction")); |
159 | } |
160 | |
161 | /** |
162 | * This returns the label text for the adapted class. |
163 | * <!-- begin-user-doc --> |
164 | * <!-- end-user-doc --> |
165 | * @generated |
166 | */ |
167 | @Override |
168 | public String getText(Object object) { |
169 | String label = ((EmitEventAction)object).getId(); |
170 | return label == null || label.length() == 0 ? |
171 | getString("_UI_EmitEventAction_type") : |
172 | getString("_UI_EmitEventAction_type") + " " + label; |
173 | } |
174 | |
175 | /** |
176 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
177 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | @Override |
183 | public void notifyChanged(Notification notification) { |
184 | updateChildren(notification); |
185 | |
186 | switch (notification.getFeatureID(EmitEventAction.class)) { |
187 | case SeffPackage.EMIT_EVENT_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION: |
188 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
189 | return; |
190 | } |
191 | super.notifyChanged(notification); |
192 | } |
193 | |
194 | /** |
195 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
196 | * that can be created under this object. |
197 | * <!-- begin-user-doc --> |
198 | * <!-- end-user-doc --> |
199 | * @generated |
200 | */ |
201 | @Override |
202 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
203 | super.collectNewChildDescriptors(newChildDescriptors, object); |
204 | |
205 | newChildDescriptors.add |
206 | (createChildParameter |
207 | (SeffPackage.Literals.CALL_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION, |
208 | ParameterFactory.eINSTANCE.createVariableUsage())); |
209 | } |
210 | |
211 | } |