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.parameters.provider.ParameterPartitionItemProvider; |
13 | |
14 | import de.fzi.se.quality.provider.QualityEditPlugin; |
15 | |
16 | import de.fzi.se.quality.qualityannotation.PCMParameterPartition; |
17 | import de.fzi.se.quality.qualityannotation.QualityAnnotationFactory; |
18 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
19 | |
20 | import java.util.Collection; |
21 | import java.util.List; |
22 | |
23 | import org.eclipse.emf.common.notify.AdapterFactory; |
24 | import org.eclipse.emf.common.notify.Notification; |
25 | |
26 | import org.eclipse.emf.common.util.ResourceLocator; |
27 | |
28 | import org.eclipse.emf.ecore.EStructuralFeature; |
29 | |
30 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
31 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
32 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
33 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
34 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
35 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
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.PCMParameterPartition} object. |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @generated |
43 | */ |
44 | public class PCMParameterPartitionItemProvider |
45 | extends ParameterPartitionItemProvider |
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 PCMParameterPartitionItemProvider(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(QualityAnnotationPackage.Literals.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS); |
90 | childrenFeatures.add(QualityAnnotationPackage.Literals.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE); |
91 | } |
92 | return childrenFeatures; |
93 | } |
94 | |
95 | /** |
96 | * <!-- begin-user-doc --> |
97 | * <!-- end-user-doc --> |
98 | * @generated |
99 | */ |
100 | @Override |
101 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
102 | // Check the type of the specified child object and return the proper feature to use for |
103 | // adding (see {@link AddCommand}) it as a child. |
104 | |
105 | return super.getChildFeature(object, child); |
106 | } |
107 | |
108 | /** |
109 | * This returns PCMParameterPartition.gif. |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | @Override |
115 | public Object getImage(Object object) { |
116 | return overlayImage(object, getResourceLocator().getImage("full/obj16/PCMParameterPartition")); |
117 | } |
118 | |
119 | /** |
120 | * This returns the label text for the adapted class. |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | @Override |
126 | public String getText(Object object) { |
127 | String label = ((PCMParameterPartition)object).getId(); |
128 | return label == null || label.length() == 0 ? |
129 | getString("_UI_PCMParameterPartition_type") : |
130 | getString("_UI_PCMParameterPartition_type") + " " + label; |
131 | } |
132 | |
133 | /** |
134 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
135 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
136 | * <!-- begin-user-doc --> |
137 | * <!-- end-user-doc --> |
138 | * @generated |
139 | */ |
140 | @Override |
141 | public void notifyChanged(Notification notification) { |
142 | updateChildren(notification); |
143 | |
144 | switch (notification.getFeatureID(PCMParameterPartition.class)) { |
145 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS: |
146 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE: |
147 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
148 | return; |
149 | } |
150 | super.notifyChanged(notification); |
151 | } |
152 | |
153 | /** |
154 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
155 | * that can be created under this object. |
156 | * <!-- begin-user-doc --> |
157 | * <!-- end-user-doc --> |
158 | * @generated |
159 | */ |
160 | @Override |
161 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
162 | super.collectNewChildDescriptors(newChildDescriptors, object); |
163 | |
164 | newChildDescriptors.add |
165 | (createChildParameter |
166 | (QualityAnnotationPackage.Literals.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS, |
167 | QualityAnnotationFactory.eINSTANCE.createCharacterisedPCMParameterPartitionInterval())); |
168 | |
169 | newChildDescriptors.add |
170 | (createChildParameter |
171 | (QualityAnnotationPackage.Literals.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS, |
172 | QualityAnnotationFactory.eINSTANCE.createCharacterisedPCMParameterPartitionRange())); |
173 | |
174 | newChildDescriptors.add |
175 | (createChildParameter |
176 | (QualityAnnotationPackage.Literals.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE, |
177 | PCMFactory.eINSTANCE.createPCMComponentParameterReference())); |
178 | |
179 | newChildDescriptors.add |
180 | (createChildParameter |
181 | (QualityAnnotationPackage.Literals.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE, |
182 | PCMFactory.eINSTANCE.createPCMOperationParameterReference())); |
183 | |
184 | newChildDescriptors.add |
185 | (createChildParameter |
186 | (QualityAnnotationPackage.Literals.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE, |
187 | PCMFactory.eINSTANCE.createPCMRequiredBusinessOperationReturnParameterReference())); |
188 | } |
189 | |
190 | /** |
191 | * Return the resource locator for this item provider's resources. |
192 | * <!-- begin-user-doc --> |
193 | * <!-- end-user-doc --> |
194 | * @generated |
195 | */ |
196 | @Override |
197 | public ResourceLocator getResourceLocator() { |
198 | return QualityEditPlugin.INSTANCE; |
199 | } |
200 | |
201 | } |