1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.usagemodel.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.repository.BasicComponent; |
26 | import de.uka.ipd.sdq.pcm.usagemodel.EntryLevelSystemCall; |
27 | import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage; |
28 | |
29 | /** |
30 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.EntryLevelSystemCall} object. |
31 | * <!-- begin-user-doc --> |
32 | * <!-- end-user-doc --> |
33 | * @generated |
34 | */ |
35 | public class EntryLevelSystemCallItemProvider |
36 | extends AbstractUserActionItemProvider |
37 | implements |
38 | IEditingDomainItemProvider, |
39 | IStructuredItemContentProvider, |
40 | ITreeItemContentProvider, |
41 | IItemLabelProvider, |
42 | IItemPropertySource { |
43 | /** |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @generated |
47 | */ |
48 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
49 | |
50 | /** |
51 | * This constructs an instance from a factory and a notifier. |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @generated |
55 | */ |
56 | public EntryLevelSystemCallItemProvider(AdapterFactory adapterFactory) { |
57 | super(adapterFactory); |
58 | } |
59 | |
60 | /** |
61 | * This returns the property descriptors for the adapted class. |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @generated |
65 | */ |
66 | @Override |
67 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
68 | if (itemPropertyDescriptors == null) { |
69 | super.getPropertyDescriptors(object); |
70 | |
71 | addProvidedRole_EntryLevelSystemCallPropertyDescriptor(object); |
72 | addOperationSignature__EntryLevelSystemCallPropertyDescriptor(object); |
73 | } |
74 | return itemPropertyDescriptors; |
75 | } |
76 | |
77 | /** |
78 | * This adds a property descriptor for the Provided Role Entry Level System Call feature. |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | protected void addProvidedRole_EntryLevelSystemCallPropertyDescriptor(Object object) { |
84 | itemPropertyDescriptors.add |
85 | (createItemPropertyDescriptor |
86 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
87 | getResourceLocator(), |
88 | getString("_UI_EntryLevelSystemCall_providedRole_EntryLevelSystemCall_feature"), |
89 | getString("_UI_PropertyDescriptor_description", "_UI_EntryLevelSystemCall_providedRole_EntryLevelSystemCall_feature", "_UI_EntryLevelSystemCall_type"), |
90 | UsagemodelPackage.Literals.ENTRY_LEVEL_SYSTEM_CALL__PROVIDED_ROLE_ENTRY_LEVEL_SYSTEM_CALL, |
91 | true, |
92 | false, |
93 | true, |
94 | null, |
95 | null, |
96 | null)); |
97 | } |
98 | |
99 | /** |
100 | * This adds a property descriptor for the Operation Signature Entry Level System Call feature. |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @generated |
104 | */ |
105 | protected void addOperationSignature__EntryLevelSystemCallPropertyDescriptor(Object object) { |
106 | itemPropertyDescriptors.add |
107 | (createItemPropertyDescriptor |
108 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
109 | getResourceLocator(), |
110 | getString("_UI_EntryLevelSystemCall_operationSignature__EntryLevelSystemCall_feature"), |
111 | getString("_UI_PropertyDescriptor_description", "_UI_EntryLevelSystemCall_operationSignature__EntryLevelSystemCall_feature", "_UI_EntryLevelSystemCall_type"), |
112 | UsagemodelPackage.Literals.ENTRY_LEVEL_SYSTEM_CALL__OPERATION_SIGNATURE_ENTRY_LEVEL_SYSTEM_CALL, |
113 | true, |
114 | false, |
115 | true, |
116 | null, |
117 | null, |
118 | null)); |
119 | } |
120 | |
121 | /** |
122 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
123 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
124 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | @Override |
130 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
131 | if (childrenFeatures == null) { |
132 | super.getChildrenFeatures(object); |
133 | childrenFeatures.add(UsagemodelPackage.Literals.ENTRY_LEVEL_SYSTEM_CALL__OUTPUT_PARAMETER_USAGES_ENTRY_LEVEL_SYSTEM_CALL); |
134 | childrenFeatures.add(UsagemodelPackage.Literals.ENTRY_LEVEL_SYSTEM_CALL__INPUT_PARAMETER_USAGES_ENTRY_LEVEL_SYSTEM_CALL); |
135 | } |
136 | return childrenFeatures; |
137 | } |
138 | |
139 | /** |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | @Override |
145 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
146 | // Check the type of the specified child object and return the proper feature to use for |
147 | // adding (see {@link AddCommand}) it as a child. |
148 | |
149 | return super.getChildFeature(object, child); |
150 | } |
151 | |
152 | /** |
153 | * This returns EntryLevelSystemCall.gif. |
154 | * <!-- begin-user-doc --> |
155 | * <!-- end-user-doc --> |
156 | * @generated |
157 | */ |
158 | @Override |
159 | public Object getImage(Object object) { |
160 | return overlayImage(object, getResourceLocator().getImage("full/obj16/EntryLevelSystemCall")); |
161 | } |
162 | |
163 | /** |
164 | * This returns the label text for the adapted class. |
165 | * <!-- begin-user-doc --> |
166 | * FB: Adapted method to produce a more informative label for display in non-PCM editors. |
167 | * In PCM editors, display is not controlled by this method but through a more general |
168 | * mechanism (I'n not sure where it's actually controlled, maybe the |
169 | * de.uka.ipd.sdq.pcmbench.tabs.PropertyLabelProvider.getText() method?) |
170 | * <!-- end-user-doc --> |
171 | * @generated not |
172 | */ |
173 | @Override |
174 | public String getText(Object object) { |
175 | return ((EntryLevelSystemCall)object).getEntityName() |
176 | + " [ID: " + ((EntryLevelSystemCall)object).getId() + "]" |
177 | + " <" + getString("_UI_EntryLevelSystemCall_type") + ">"; |
178 | } |
179 | |
180 | /** |
181 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
182 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
183 | * <!-- begin-user-doc --> |
184 | * <!-- end-user-doc --> |
185 | * @generated |
186 | */ |
187 | @Override |
188 | public void notifyChanged(Notification notification) { |
189 | updateChildren(notification); |
190 | |
191 | switch (notification.getFeatureID(EntryLevelSystemCall.class)) { |
192 | case UsagemodelPackage.ENTRY_LEVEL_SYSTEM_CALL__OUTPUT_PARAMETER_USAGES_ENTRY_LEVEL_SYSTEM_CALL: |
193 | case UsagemodelPackage.ENTRY_LEVEL_SYSTEM_CALL__INPUT_PARAMETER_USAGES_ENTRY_LEVEL_SYSTEM_CALL: |
194 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
195 | return; |
196 | } |
197 | super.notifyChanged(notification); |
198 | } |
199 | |
200 | /** |
201 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
202 | * that can be created under this object. |
203 | * <!-- begin-user-doc --> |
204 | * <!-- end-user-doc --> |
205 | * @generated |
206 | */ |
207 | @Override |
208 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
209 | super.collectNewChildDescriptors(newChildDescriptors, object); |
210 | |
211 | newChildDescriptors.add |
212 | (createChildParameter |
213 | (UsagemodelPackage.Literals.ENTRY_LEVEL_SYSTEM_CALL__OUTPUT_PARAMETER_USAGES_ENTRY_LEVEL_SYSTEM_CALL, |
214 | ParameterFactory.eINSTANCE.createVariableUsage())); |
215 | |
216 | newChildDescriptors.add |
217 | (createChildParameter |
218 | (UsagemodelPackage.Literals.ENTRY_LEVEL_SYSTEM_CALL__INPUT_PARAMETER_USAGES_ENTRY_LEVEL_SYSTEM_CALL, |
219 | ParameterFactory.eINSTANCE.createVariableUsage())); |
220 | } |
221 | |
222 | /** |
223 | * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. |
224 | * <!-- begin-user-doc --> |
225 | * <!-- end-user-doc --> |
226 | * @generated |
227 | */ |
228 | @Override |
229 | public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { |
230 | Object childFeature = feature; |
231 | Object childObject = child; |
232 | |
233 | boolean qualify = |
234 | childFeature == UsagemodelPackage.Literals.ENTRY_LEVEL_SYSTEM_CALL__OUTPUT_PARAMETER_USAGES_ENTRY_LEVEL_SYSTEM_CALL || |
235 | childFeature == UsagemodelPackage.Literals.ENTRY_LEVEL_SYSTEM_CALL__INPUT_PARAMETER_USAGES_ENTRY_LEVEL_SYSTEM_CALL; |
236 | |
237 | if (qualify) { |
238 | return getString |
239 | ("_UI_CreateChild_text2", |
240 | new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); |
241 | } |
242 | return super.getCreateChildText(owner, feature, child, selection); |
243 | } |
244 | |
245 | } |