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.common.util.ResourceLocator; |
15 | import org.eclipse.emf.ecore.EStructuralFeature; |
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.ItemProviderAdapter; |
23 | import org.eclipse.emf.edit.provider.ViewerNotification; |
24 | |
25 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
26 | import de.uka.ipd.sdq.pcm.seff.ResourceDemandingBehaviour; |
27 | import de.uka.ipd.sdq.pcm.seff.SeffFactory; |
28 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
29 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityFactory; |
30 | |
31 | /** |
32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.seff.ResourceDemandingBehaviour} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class ResourceDemandingBehaviourItemProvider |
38 | extends ItemProviderAdapter |
39 | implements |
40 | IEditingDomainItemProvider, |
41 | IStructuredItemContentProvider, |
42 | ITreeItemContentProvider, |
43 | IItemLabelProvider, |
44 | IItemPropertySource { |
45 | /** |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @generated |
49 | */ |
50 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
51 | |
52 | /** |
53 | * This constructs an instance from a factory and a notifier. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | public ResourceDemandingBehaviourItemProvider(AdapterFactory adapterFactory) { |
59 | super(adapterFactory); |
60 | } |
61 | |
62 | /** |
63 | * This returns the property descriptors for the adapted class. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | */ |
68 | @Override |
69 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
70 | if (itemPropertyDescriptors == null) { |
71 | super.getPropertyDescriptors(object); |
72 | |
73 | } |
74 | return itemPropertyDescriptors; |
75 | } |
76 | |
77 | /** |
78 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
79 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
80 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | @Override |
86 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
87 | if (childrenFeatures == null) { |
88 | super.getChildrenFeatures(object); |
89 | childrenFeatures.add(SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR); |
90 | } |
91 | return childrenFeatures; |
92 | } |
93 | |
94 | /** |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | @Override |
100 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
101 | // Check the type of the specified child object and return the proper feature to use for |
102 | // adding (see {@link AddCommand}) it as a child. |
103 | |
104 | return super.getChildFeature(object, child); |
105 | } |
106 | |
107 | /** |
108 | * This returns ResourceDemandingBehaviour.gif. |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | @Override |
114 | public Object getImage(Object object) { |
115 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ResourceDemandingBehaviour")); |
116 | } |
117 | |
118 | /** |
119 | * This returns the label text for the adapted class. |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @generated |
123 | */ |
124 | @Override |
125 | public String getText(Object object) { |
126 | return getString("_UI_ResourceDemandingBehaviour_type"); |
127 | } |
128 | |
129 | /** |
130 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
131 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | @Override |
137 | public void notifyChanged(Notification notification) { |
138 | updateChildren(notification); |
139 | |
140 | switch (notification.getFeatureID(ResourceDemandingBehaviour.class)) { |
141 | case SeffPackage.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR: |
142 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
143 | return; |
144 | } |
145 | super.notifyChanged(notification); |
146 | } |
147 | |
148 | /** |
149 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
150 | * that can be created under this object. |
151 | * <!-- begin-user-doc --> |
152 | * <!-- end-user-doc --> |
153 | * @generated |
154 | */ |
155 | @Override |
156 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
157 | super.collectNewChildDescriptors(newChildDescriptors, object); |
158 | |
159 | newChildDescriptors.add |
160 | (createChildParameter |
161 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
162 | SeffFactory.eINSTANCE.createStopAction())); |
163 | |
164 | newChildDescriptors.add |
165 | (createChildParameter |
166 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
167 | SeffFactory.eINSTANCE.createBranchAction())); |
168 | |
169 | newChildDescriptors.add |
170 | (createChildParameter |
171 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
172 | SeffFactory.eINSTANCE.createStartAction())); |
173 | |
174 | newChildDescriptors.add |
175 | (createChildParameter |
176 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
177 | SeffFactory.eINSTANCE.createReleaseAction())); |
178 | |
179 | newChildDescriptors.add |
180 | (createChildParameter |
181 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
182 | SeffFactory.eINSTANCE.createLoopAction())); |
183 | |
184 | newChildDescriptors.add |
185 | (createChildParameter |
186 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
187 | SeffFactory.eINSTANCE.createForkAction())); |
188 | |
189 | newChildDescriptors.add |
190 | (createChildParameter |
191 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
192 | SeffFactory.eINSTANCE.createExternalCallAction())); |
193 | |
194 | newChildDescriptors.add |
195 | (createChildParameter |
196 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
197 | SeffFactory.eINSTANCE.createAcquireAction())); |
198 | |
199 | newChildDescriptors.add |
200 | (createChildParameter |
201 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
202 | SeffFactory.eINSTANCE.createCollectionIteratorAction())); |
203 | |
204 | newChildDescriptors.add |
205 | (createChildParameter |
206 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
207 | SeffFactory.eINSTANCE.createSetVariableAction())); |
208 | |
209 | newChildDescriptors.add |
210 | (createChildParameter |
211 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
212 | SeffFactory.eINSTANCE.createInternalCallAction())); |
213 | |
214 | newChildDescriptors.add |
215 | (createChildParameter |
216 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
217 | SeffFactory.eINSTANCE.createEmitEventAction())); |
218 | |
219 | newChildDescriptors.add |
220 | (createChildParameter |
221 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
222 | SeffFactory.eINSTANCE.createInternalAction())); |
223 | |
224 | newChildDescriptors.add |
225 | (createChildParameter |
226 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
227 | Seff_reliabilityFactory.eINSTANCE.createRecoveryAction())); |
228 | } |
229 | |
230 | /** |
231 | * Return the resource locator for this item provider's resources. |
232 | * <!-- begin-user-doc --> |
233 | * <!-- end-user-doc --> |
234 | * @generated |
235 | */ |
236 | @Override |
237 | public ResourceLocator getResourceLocator() { |
238 | return PalladioComponentModelEditPlugin.INSTANCE; |
239 | } |
240 | |
241 | } |