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.provider.QualityEditPlugin; |
11 | import de.fzi.se.quality.provider.QualityStatementItemProvider; |
12 | |
13 | import de.fzi.se.quality.qualityannotation.QualityAnnotation; |
14 | import de.fzi.se.quality.qualityannotation.QualityAnnotationFactory; |
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.ViewerNotification; |
36 | |
37 | /** |
38 | * This is the item provider adapter for a {@link de.fzi.se.quality.qualityannotation.QualityAnnotation} object. |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @generated |
42 | */ |
43 | public class QualityAnnotationItemProvider |
44 | extends QualityStatementItemProvider |
45 | implements |
46 | IEditingDomainItemProvider, |
47 | IStructuredItemContentProvider, |
48 | ITreeItemContentProvider, |
49 | IItemLabelProvider, |
50 | IItemPropertySource { |
51 | /** |
52 | * This constructs an instance from a factory and a notifier. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @generated |
56 | */ |
57 | public QualityAnnotationItemProvider(AdapterFactory adapterFactory) { |
58 | super(adapterFactory); |
59 | } |
60 | |
61 | /** |
62 | * This returns the property descriptors for the adapted class. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | @Override |
68 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
69 | if (itemPropertyDescriptors == null) { |
70 | super.getPropertyDescriptors(object); |
71 | |
72 | addIsValidPropertyDescriptor(object); |
73 | } |
74 | return itemPropertyDescriptors; |
75 | } |
76 | |
77 | /** |
78 | * This adds a property descriptor for the Is Valid feature. |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | protected void addIsValidPropertyDescriptor(Object object) { |
84 | itemPropertyDescriptors.add |
85 | (createItemPropertyDescriptor |
86 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
87 | getResourceLocator(), |
88 | getString("_UI_QualityAnnotation_isValid_feature"), |
89 | getString("_UI_PropertyDescriptor_description", "_UI_QualityAnnotation_isValid_feature", "_UI_QualityAnnotation_type"), |
90 | QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__IS_VALID, |
91 | true, |
92 | false, |
93 | false, |
94 | ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, |
95 | null, |
96 | null)); |
97 | } |
98 | |
99 | /** |
100 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
101 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
102 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | @Override |
108 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
109 | if (childrenFeatures == null) { |
110 | super.getChildrenFeatures(object); |
111 | childrenFeatures.add(QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION); |
112 | childrenFeatures.add(QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS); |
113 | childrenFeatures.add(QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_RESULT); |
114 | childrenFeatures.add(QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__VALID_FOR_PARAMETER_PARTITIONS); |
115 | } |
116 | return childrenFeatures; |
117 | } |
118 | |
119 | /** |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @generated |
123 | */ |
124 | @Override |
125 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
126 | // Check the type of the specified child object and return the proper feature to use for |
127 | // adding (see {@link AddCommand}) it as a child. |
128 | |
129 | return super.getChildFeature(object, child); |
130 | } |
131 | |
132 | /** |
133 | * This returns QualityAnnotation.gif. |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | @Override |
139 | public Object getImage(Object object) { |
140 | return overlayImage(object, getResourceLocator().getImage("full/obj16/QualityAnnotation")); |
141 | } |
142 | |
143 | /** |
144 | * This returns the label text for the adapted class. |
145 | * <!-- begin-user-doc --> |
146 | * <!-- end-user-doc --> |
147 | * @generated |
148 | */ |
149 | @Override |
150 | public String getText(Object object) { |
151 | String label = ((QualityAnnotation)object).getId(); |
152 | return label == null || label.length() == 0 ? |
153 | getString("_UI_QualityAnnotation_type") : |
154 | getString("_UI_QualityAnnotation_type") + " " + label; |
155 | } |
156 | |
157 | /** |
158 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
159 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
160 | * <!-- begin-user-doc --> |
161 | * <!-- end-user-doc --> |
162 | * @generated |
163 | */ |
164 | @Override |
165 | public void notifyChanged(Notification notification) { |
166 | updateChildren(notification); |
167 | |
168 | switch (notification.getFeatureID(QualityAnnotation.class)) { |
169 | case QualityAnnotationPackage.QUALITY_ANNOTATION__IS_VALID: |
170 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
171 | return; |
172 | case QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION: |
173 | case QualityAnnotationPackage.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS: |
174 | case QualityAnnotationPackage.QUALITY_ANNOTATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_RESULT: |
175 | case QualityAnnotationPackage.QUALITY_ANNOTATION__VALID_FOR_PARAMETER_PARTITIONS: |
176 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
177 | return; |
178 | } |
179 | super.notifyChanged(notification); |
180 | } |
181 | |
182 | /** |
183 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
184 | * that can be created under this object. |
185 | * <!-- begin-user-doc --> |
186 | * <!-- end-user-doc --> |
187 | * @generated |
188 | */ |
189 | @Override |
190 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
191 | super.collectNewChildDescriptors(newChildDescriptors, object); |
192 | |
193 | newChildDescriptors.add |
194 | (createChildParameter |
195 | (QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION, |
196 | QualityAnnotationFactory.eINSTANCE.createPCMServiceSpecification())); |
197 | |
198 | newChildDescriptors.add |
199 | (createChildParameter |
200 | (QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS, |
201 | QualityAnnotationFactory.eINSTANCE.createRequiredElement())); |
202 | |
203 | newChildDescriptors.add |
204 | (createChildParameter |
205 | (QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS, |
206 | QualityAnnotationFactory.eINSTANCE.createPCMRECategory())); |
207 | |
208 | newChildDescriptors.add |
209 | (createChildParameter |
210 | (QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS, |
211 | QualityAnnotationFactory.eINSTANCE.createPCMREInterface())); |
212 | |
213 | newChildDescriptors.add |
214 | (createChildParameter |
215 | (QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS, |
216 | QualityAnnotationFactory.eINSTANCE.createPCMRERole())); |
217 | |
218 | newChildDescriptors.add |
219 | (createChildParameter |
220 | (QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS, |
221 | QualityAnnotationFactory.eINSTANCE.createPCMRESignature())); |
222 | |
223 | newChildDescriptors.add |
224 | (createChildParameter |
225 | (QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS, |
226 | QualityAnnotationFactory.eINSTANCE.createPCMREResourceInterface())); |
227 | |
228 | newChildDescriptors.add |
229 | (createChildParameter |
230 | (QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS, |
231 | QualityAnnotationFactory.eINSTANCE.createPCMREResourceSignature())); |
232 | |
233 | newChildDescriptors.add |
234 | (createChildParameter |
235 | (QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_RESULT, |
236 | QualityAnnotationFactory.eINSTANCE.createInternalStateInfluenceAnalysisAggregation())); |
237 | |
238 | newChildDescriptors.add |
239 | (createChildParameter |
240 | (QualityAnnotationPackage.Literals.QUALITY_ANNOTATION__VALID_FOR_PARAMETER_PARTITIONS, |
241 | QualityAnnotationFactory.eINSTANCE.createPCMParameterPartition())); |
242 | } |
243 | |
244 | /** |
245 | * Return the resource locator for this item provider's resources. |
246 | * <!-- begin-user-doc --> |
247 | * <!-- end-user-doc --> |
248 | * @generated |
249 | */ |
250 | @Override |
251 | public ResourceLocator getResourceLocator() { |
252 | return QualityEditPlugin.INSTANCE; |
253 | } |
254 | |
255 | } |