1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.fzi.se.quality.qualityannotation.provider; |
8 | |
9 | |
10 | import de.fzi.se.quality.parameters.pcm.PCMFactory; |
11 | |
12 | import de.fzi.se.quality.provider.QualityEditPlugin; |
13 | |
14 | import de.fzi.se.quality.qualityannotation.CallParameterDeviation; |
15 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
16 | |
17 | import java.util.Collection; |
18 | import java.util.List; |
19 | |
20 | import org.eclipse.emf.common.notify.AdapterFactory; |
21 | import org.eclipse.emf.common.notify.Notification; |
22 | |
23 | import org.eclipse.emf.common.util.ResourceLocator; |
24 | |
25 | import org.eclipse.emf.ecore.EStructuralFeature; |
26 | |
27 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
28 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
29 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
30 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
31 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
32 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
33 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
34 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
35 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
36 | import org.eclipse.emf.edit.provider.ViewerNotification; |
37 | |
38 | /** |
39 | * This is the item provider adapter for a {@link de.fzi.se.quality.qualityannotation.CallParameterDeviation} object. |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @generated |
43 | */ |
44 | public class CallParameterDeviationItemProvider |
45 | extends ItemProviderAdapter |
46 | implements |
47 | IEditingDomainItemProvider, |
48 | IStructuredItemContentProvider, |
49 | ITreeItemContentProvider, |
50 | IItemLabelProvider, |
51 | IItemPropertySource { |
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 CallParameterDeviationItemProvider(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 | addMaximumPropertyDescriptor(object); |
74 | } |
75 | return itemPropertyDescriptors; |
76 | } |
77 | |
78 | /** |
79 | * This adds a property descriptor for the Maximum feature. |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | protected void addMaximumPropertyDescriptor(Object object) { |
85 | itemPropertyDescriptors.add |
86 | (createItemPropertyDescriptor |
87 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
88 | getResourceLocator(), |
89 | getString("_UI_CallParameterDeviation_maximum_feature"), |
90 | getString("_UI_PropertyDescriptor_description", "_UI_CallParameterDeviation_maximum_feature", "_UI_CallParameterDeviation_type"), |
91 | QualityAnnotationPackage.Literals.CALL_PARAMETER_DEVIATION__MAXIMUM, |
92 | true, |
93 | false, |
94 | false, |
95 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
96 | null, |
97 | null)); |
98 | } |
99 | |
100 | /** |
101 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
102 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
103 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @generated |
107 | */ |
108 | @Override |
109 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
110 | if (childrenFeatures == null) { |
111 | super.getChildrenFeatures(object); |
112 | childrenFeatures.add(QualityAnnotationPackage.Literals.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE); |
113 | } |
114 | return childrenFeatures; |
115 | } |
116 | |
117 | /** |
118 | * <!-- begin-user-doc --> |
119 | * <!-- end-user-doc --> |
120 | * @generated |
121 | */ |
122 | @Override |
123 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
124 | // Check the type of the specified child object and return the proper feature to use for |
125 | // adding (see {@link AddCommand}) it as a child. |
126 | |
127 | return super.getChildFeature(object, child); |
128 | } |
129 | |
130 | /** |
131 | * This returns CallParameterDeviation.gif. |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | @Override |
137 | public Object getImage(Object object) { |
138 | return overlayImage(object, getResourceLocator().getImage("full/obj16/CallParameterDeviation")); |
139 | } |
140 | |
141 | /** |
142 | * This returns the label text for the adapted class. |
143 | * <!-- begin-user-doc --> |
144 | * <!-- end-user-doc --> |
145 | * @generated |
146 | */ |
147 | @Override |
148 | public String getText(Object object) { |
149 | CallParameterDeviation callParameterDeviation = (CallParameterDeviation)object; |
150 | return getString("_UI_CallParameterDeviation_type") + " " + callParameterDeviation.getMaximum(); |
151 | } |
152 | |
153 | /** |
154 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
155 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
156 | * <!-- begin-user-doc --> |
157 | * <!-- end-user-doc --> |
158 | * @generated |
159 | */ |
160 | @Override |
161 | public void notifyChanged(Notification notification) { |
162 | updateChildren(notification); |
163 | |
164 | switch (notification.getFeatureID(CallParameterDeviation.class)) { |
165 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__MAXIMUM: |
166 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
167 | return; |
168 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE: |
169 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
170 | return; |
171 | } |
172 | super.notifyChanged(notification); |
173 | } |
174 | |
175 | /** |
176 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
177 | * that can be created under this object. |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | @Override |
183 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
184 | super.collectNewChildDescriptors(newChildDescriptors, object); |
185 | |
186 | newChildDescriptors.add |
187 | (createChildParameter |
188 | (QualityAnnotationPackage.Literals.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE, |
189 | PCMFactory.eINSTANCE.createPCMComponentParameterReference())); |
190 | |
191 | newChildDescriptors.add |
192 | (createChildParameter |
193 | (QualityAnnotationPackage.Literals.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE, |
194 | PCMFactory.eINSTANCE.createPCMOperationParameterReference())); |
195 | |
196 | newChildDescriptors.add |
197 | (createChildParameter |
198 | (QualityAnnotationPackage.Literals.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE, |
199 | PCMFactory.eINSTANCE.createPCMRequiredBusinessOperationReturnParameterReference())); |
200 | } |
201 | |
202 | /** |
203 | * Return the resource locator for this item provider's resources. |
204 | * <!-- begin-user-doc --> |
205 | * <!-- end-user-doc --> |
206 | * @generated |
207 | */ |
208 | @Override |
209 | public ResourceLocator getResourceLocator() { |
210 | return QualityEditPlugin.INSTANCE; |
211 | } |
212 | |
213 | } |