1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.fzi.se.quality.parameters.provider; |
8 | |
9 | |
10 | import de.fzi.se.quality.parameters.ParameterInstance; |
11 | import de.fzi.se.quality.parameters.ParametersPackage; |
12 | |
13 | import de.fzi.se.quality.parameters.pcm.PCMFactory; |
14 | |
15 | import de.fzi.se.quality.provider.QualityEditPlugin; |
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.IEditingDomainItemProvider; |
28 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
29 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
30 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
31 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
32 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
33 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
34 | import org.eclipse.emf.edit.provider.ViewerNotification; |
35 | |
36 | /** |
37 | * This is the item provider adapter for a {@link de.fzi.se.quality.parameters.ParameterInstance} object. |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @generated |
41 | */ |
42 | public class ParameterInstanceItemProvider |
43 | extends ItemProviderAdapter |
44 | implements |
45 | IEditingDomainItemProvider, |
46 | IStructuredItemContentProvider, |
47 | ITreeItemContentProvider, |
48 | IItemLabelProvider, |
49 | IItemPropertySource { |
50 | /** |
51 | * This constructs an instance from a factory and a notifier. |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @generated |
55 | */ |
56 | public ParameterInstanceItemProvider(AdapterFactory adapterFactory) { |
57 | super(adapterFactory); |
58 | } |
59 | |
60 | /** |
61 | * This returns the property descriptors for the adapted class. |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @generated |
65 | */ |
66 | @Override |
67 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
68 | if (itemPropertyDescriptors == null) { |
69 | super.getPropertyDescriptors(object); |
70 | |
71 | } |
72 | return itemPropertyDescriptors; |
73 | } |
74 | |
75 | /** |
76 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
77 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
78 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | @Override |
84 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
85 | if (childrenFeatures == null) { |
86 | super.getChildrenFeatures(object); |
87 | childrenFeatures.add(ParametersPackage.Literals.PARAMETER_INSTANCE__PARAMETER_REFERENCE); |
88 | childrenFeatures.add(ParametersPackage.Literals.PARAMETER_INSTANCE__PARAMETER_VALUE); |
89 | } |
90 | return childrenFeatures; |
91 | } |
92 | |
93 | /** |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @generated |
97 | */ |
98 | @Override |
99 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
100 | // Check the type of the specified child object and return the proper feature to use for |
101 | // adding (see {@link AddCommand}) it as a child. |
102 | |
103 | return super.getChildFeature(object, child); |
104 | } |
105 | |
106 | /** |
107 | * This returns ParameterInstance.gif. |
108 | * <!-- begin-user-doc --> |
109 | * <!-- end-user-doc --> |
110 | * @generated |
111 | */ |
112 | @Override |
113 | public Object getImage(Object object) { |
114 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ParameterInstance")); |
115 | } |
116 | |
117 | /** |
118 | * This returns the label text for the adapted class. |
119 | * <!-- begin-user-doc --> |
120 | * <!-- end-user-doc --> |
121 | * @generated |
122 | */ |
123 | @Override |
124 | public String getText(Object object) { |
125 | return getString("_UI_ParameterInstance_type"); |
126 | } |
127 | |
128 | /** |
129 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
130 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | @Override |
136 | public void notifyChanged(Notification notification) { |
137 | updateChildren(notification); |
138 | |
139 | switch (notification.getFeatureID(ParameterInstance.class)) { |
140 | case ParametersPackage.PARAMETER_INSTANCE__PARAMETER_REFERENCE: |
141 | case ParametersPackage.PARAMETER_INSTANCE__PARAMETER_VALUE: |
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 | (ParametersPackage.Literals.PARAMETER_INSTANCE__PARAMETER_REFERENCE, |
162 | PCMFactory.eINSTANCE.createPCMComponentParameterReference())); |
163 | |
164 | newChildDescriptors.add |
165 | (createChildParameter |
166 | (ParametersPackage.Literals.PARAMETER_INSTANCE__PARAMETER_REFERENCE, |
167 | PCMFactory.eINSTANCE.createPCMOperationParameterReference())); |
168 | |
169 | newChildDescriptors.add |
170 | (createChildParameter |
171 | (ParametersPackage.Literals.PARAMETER_INSTANCE__PARAMETER_REFERENCE, |
172 | PCMFactory.eINSTANCE.createPCMRequiredBusinessOperationReturnParameterReference())); |
173 | |
174 | newChildDescriptors.add |
175 | (createChildParameter |
176 | (ParametersPackage.Literals.PARAMETER_INSTANCE__PARAMETER_VALUE, |
177 | PCMFactory.eINSTANCE.createPCMParameterValue())); |
178 | } |
179 | |
180 | /** |
181 | * Return the resource locator for this item provider's resources. |
182 | * <!-- begin-user-doc --> |
183 | * <!-- end-user-doc --> |
184 | * @generated |
185 | */ |
186 | @Override |
187 | public ResourceLocator getResourceLocator() { |
188 | return QualityEditPlugin.INSTANCE; |
189 | } |
190 | |
191 | } |