1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.seff.seff_performance.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.ComposeableAdapterFactory; |
17 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
18 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
19 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
20 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
21 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
22 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
23 | import org.eclipse.emf.edit.provider.ViewerNotification; |
24 | |
25 | import de.uka.ipd.sdq.pcm.core.CoreFactory; |
26 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
27 | import de.uka.ipd.sdq.pcm.seff.provider.CallActionItemProvider; |
28 | import de.uka.ipd.sdq.pcm.seff.seff_performance.InfrastructureCall; |
29 | import de.uka.ipd.sdq.pcm.seff.seff_performance.Seff_performancePackage; |
30 | |
31 | /** |
32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.seff.seff_performance.InfrastructureCall} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class InfrastructureCallItemProvider |
38 | extends CallActionItemProvider |
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 InfrastructureCallItemProvider(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 | addSignature__InfrastructureCallPropertyDescriptor(object); |
74 | addRequiredRole__InfrastructureCallPropertyDescriptor(object); |
75 | } |
76 | return itemPropertyDescriptors; |
77 | } |
78 | |
79 | /** |
80 | * This adds a property descriptor for the Signature Infrastructure Call feature. |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | protected void addSignature__InfrastructureCallPropertyDescriptor(Object object) { |
86 | itemPropertyDescriptors.add |
87 | (createItemPropertyDescriptor |
88 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
89 | getResourceLocator(), |
90 | getString("_UI_InfrastructureCall_signature__InfrastructureCall_feature"), |
91 | getString("_UI_PropertyDescriptor_description", "_UI_InfrastructureCall_signature__InfrastructureCall_feature", "_UI_InfrastructureCall_type"), |
92 | Seff_performancePackage.Literals.INFRASTRUCTURE_CALL__SIGNATURE_INFRASTRUCTURE_CALL, |
93 | true, |
94 | false, |
95 | true, |
96 | null, |
97 | null, |
98 | null)); |
99 | } |
100 | |
101 | /** |
102 | * This adds a property descriptor for the Required Role Infrastructure Call feature. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | protected void addRequiredRole__InfrastructureCallPropertyDescriptor(Object object) { |
108 | itemPropertyDescriptors.add |
109 | (createItemPropertyDescriptor |
110 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
111 | getResourceLocator(), |
112 | getString("_UI_InfrastructureCall_requiredRole__InfrastructureCall_feature"), |
113 | getString("_UI_PropertyDescriptor_description", "_UI_InfrastructureCall_requiredRole__InfrastructureCall_feature", "_UI_InfrastructureCall_type"), |
114 | Seff_performancePackage.Literals.INFRASTRUCTURE_CALL__REQUIRED_ROLE_INFRASTRUCTURE_CALL, |
115 | true, |
116 | false, |
117 | true, |
118 | null, |
119 | null, |
120 | null)); |
121 | } |
122 | |
123 | /** |
124 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
125 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
126 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
127 | * <!-- begin-user-doc --> |
128 | * <!-- end-user-doc --> |
129 | * @generated |
130 | */ |
131 | @Override |
132 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
133 | if (childrenFeatures == null) { |
134 | super.getChildrenFeatures(object); |
135 | childrenFeatures.add(Seff_performancePackage.Literals.INFRASTRUCTURE_CALL__NUMBER_OF_CALLS_INFRASTRUCTURE_CALL); |
136 | } |
137 | return childrenFeatures; |
138 | } |
139 | |
140 | /** |
141 | * <!-- begin-user-doc --> |
142 | * <!-- end-user-doc --> |
143 | * @generated |
144 | */ |
145 | @Override |
146 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
147 | // Check the type of the specified child object and return the proper feature to use for |
148 | // adding (see {@link AddCommand}) it as a child. |
149 | |
150 | return super.getChildFeature(object, child); |
151 | } |
152 | |
153 | /** |
154 | * This returns InfrastructureCall.gif. |
155 | * <!-- begin-user-doc --> |
156 | * <!-- end-user-doc --> |
157 | * @generated |
158 | */ |
159 | @Override |
160 | public Object getImage(Object object) { |
161 | return overlayImage(object, getResourceLocator().getImage("full/obj16/InfrastructureCall")); |
162 | } |
163 | |
164 | /** |
165 | * This returns the label text for the adapted class. |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @generated |
169 | */ |
170 | @Override |
171 | public String getText(Object object) { |
172 | return getString("_UI_InfrastructureCall_type"); |
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(InfrastructureCall.class)) { |
187 | case Seff_performancePackage.INFRASTRUCTURE_CALL__NUMBER_OF_CALLS_INFRASTRUCTURE_CALL: |
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 | (Seff_performancePackage.Literals.INFRASTRUCTURE_CALL__NUMBER_OF_CALLS_INFRASTRUCTURE_CALL, |
208 | CoreFactory.eINSTANCE.createPCMRandomVariable())); |
209 | } |
210 | |
211 | /** |
212 | * Return the resource locator for this item provider's resources. |
213 | * <!-- begin-user-doc --> |
214 | * <!-- end-user-doc --> |
215 | * @generated |
216 | */ |
217 | @Override |
218 | public ResourceLocator getResourceLocator() { |
219 | return PalladioComponentModelEditPlugin.INSTANCE; |
220 | } |
221 | |
222 | } |