| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package QVTBase.provider; |
| 8 | |
| 9 | |
| 10 | import EMOF.provider.ElementItemProvider; |
| 11 | import EMOF.provider.QvtmodelsEditPlugin; |
| 12 | |
| 13 | import EssentialOCL.EssentialOCLFactory; |
| 14 | |
| 15 | import QVTBase.Predicate; |
| 16 | import QVTBase.QVTBasePackage; |
| 17 | |
| 18 | import QVTRelation.QVTRelationFactory; |
| 19 | |
| 20 | import QVTTemplate.QVTTemplateFactory; |
| 21 | |
| 22 | import java.util.Collection; |
| 23 | import java.util.List; |
| 24 | |
| 25 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 26 | import org.eclipse.emf.common.notify.Notification; |
| 27 | |
| 28 | import org.eclipse.emf.common.util.ResourceLocator; |
| 29 | |
| 30 | import org.eclipse.emf.ecore.EStructuralFeature; |
| 31 | |
| 32 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 33 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| 34 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| 35 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
| 36 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
| 37 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
| 38 | import org.eclipse.emf.edit.provider.ViewerNotification; |
| 39 | |
| 40 | /** |
| 41 | * This is the item provider adapter for a {@link QVTBase.Predicate} object. |
| 42 | * <!-- begin-user-doc --> |
| 43 | * <!-- end-user-doc --> |
| 44 | * @generated |
| 45 | */ |
| 46 | public class PredicateItemProvider |
| 47 | extends ElementItemProvider |
| 48 | implements |
| 49 | IEditingDomainItemProvider, |
| 50 | IStructuredItemContentProvider, |
| 51 | ITreeItemContentProvider, |
| 52 | IItemLabelProvider, |
| 53 | IItemPropertySource { |
| 54 | /** |
| 55 | * This constructs an instance from a factory and a notifier. |
| 56 | * <!-- begin-user-doc --> |
| 57 | * <!-- end-user-doc --> |
| 58 | * @generated |
| 59 | */ |
| 60 | public PredicateItemProvider(AdapterFactory adapterFactory) { |
| 61 | super(adapterFactory); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * This returns the property descriptors for the adapted class. |
| 66 | * <!-- begin-user-doc --> |
| 67 | * <!-- end-user-doc --> |
| 68 | * @generated |
| 69 | */ |
| 70 | @Override |
| 71 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 72 | if (itemPropertyDescriptors == null) { |
| 73 | super.getPropertyDescriptors(object); |
| 74 | |
| 75 | } |
| 76 | return itemPropertyDescriptors; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| 81 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| 82 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| 83 | * <!-- begin-user-doc --> |
| 84 | * <!-- end-user-doc --> |
| 85 | * @generated |
| 86 | */ |
| 87 | @Override |
| 88 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
| 89 | if (childrenFeatures == null) { |
| 90 | super.getChildrenFeatures(object); |
| 91 | childrenFeatures.add(QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION); |
| 92 | } |
| 93 | return childrenFeatures; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * <!-- begin-user-doc --> |
| 98 | * <!-- end-user-doc --> |
| 99 | * @generated |
| 100 | */ |
| 101 | @Override |
| 102 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
| 103 | // Check the type of the specified child object and return the proper feature to use for |
| 104 | // adding (see {@link AddCommand}) it as a child. |
| 105 | |
| 106 | return super.getChildFeature(object, child); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * This returns Predicate.gif. |
| 111 | * <!-- begin-user-doc --> |
| 112 | * <!-- end-user-doc --> |
| 113 | * @generated |
| 114 | */ |
| 115 | @Override |
| 116 | public Object getImage(Object object) { |
| 117 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Predicate")); |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * This returns the label text for the adapted class. |
| 122 | * <!-- begin-user-doc --> |
| 123 | * <!-- end-user-doc --> |
| 124 | * @generated |
| 125 | */ |
| 126 | @Override |
| 127 | public String getText(Object object) { |
| 128 | return getString("_UI_Predicate_type"); |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 133 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 134 | * <!-- begin-user-doc --> |
| 135 | * <!-- end-user-doc --> |
| 136 | * @generated |
| 137 | */ |
| 138 | @Override |
| 139 | public void notifyChanged(Notification notification) { |
| 140 | updateChildren(notification); |
| 141 | |
| 142 | switch (notification.getFeatureID(Predicate.class)) { |
| 143 | case QVTBasePackage.PREDICATE__CONDITION_EXPRESSION: |
| 144 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 145 | return; |
| 146 | } |
| 147 | super.notifyChanged(notification); |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 152 | * that can be created under this object. |
| 153 | * <!-- begin-user-doc --> |
| 154 | * <!-- end-user-doc --> |
| 155 | * @generated |
| 156 | */ |
| 157 | @Override |
| 158 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 159 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 160 | |
| 161 | newChildDescriptors.add |
| 162 | (createChildParameter |
| 163 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 164 | EssentialOCLFactory.eINSTANCE.createBooleanLiteralExp())); |
| 165 | |
| 166 | newChildDescriptors.add |
| 167 | (createChildParameter |
| 168 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 169 | EssentialOCLFactory.eINSTANCE.createCollectionLiteralExp())); |
| 170 | |
| 171 | newChildDescriptors.add |
| 172 | (createChildParameter |
| 173 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 174 | EssentialOCLFactory.eINSTANCE.createEnumLiteralExp())); |
| 175 | |
| 176 | newChildDescriptors.add |
| 177 | (createChildParameter |
| 178 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 179 | EssentialOCLFactory.eINSTANCE.createIfExp())); |
| 180 | |
| 181 | newChildDescriptors.add |
| 182 | (createChildParameter |
| 183 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 184 | EssentialOCLFactory.eINSTANCE.createIntegerLiteralExp())); |
| 185 | |
| 186 | newChildDescriptors.add |
| 187 | (createChildParameter |
| 188 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 189 | EssentialOCLFactory.eINSTANCE.createInvalidLiteralExp())); |
| 190 | |
| 191 | newChildDescriptors.add |
| 192 | (createChildParameter |
| 193 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 194 | EssentialOCLFactory.eINSTANCE.createIterateExp())); |
| 195 | |
| 196 | newChildDescriptors.add |
| 197 | (createChildParameter |
| 198 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 199 | EssentialOCLFactory.eINSTANCE.createIteratorExp())); |
| 200 | |
| 201 | newChildDescriptors.add |
| 202 | (createChildParameter |
| 203 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 204 | EssentialOCLFactory.eINSTANCE.createLetExp())); |
| 205 | |
| 206 | newChildDescriptors.add |
| 207 | (createChildParameter |
| 208 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 209 | EssentialOCLFactory.eINSTANCE.createNavigationCallExp())); |
| 210 | |
| 211 | newChildDescriptors.add |
| 212 | (createChildParameter |
| 213 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 214 | EssentialOCLFactory.eINSTANCE.createNullLiteralExp())); |
| 215 | |
| 216 | newChildDescriptors.add |
| 217 | (createChildParameter |
| 218 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 219 | EssentialOCLFactory.eINSTANCE.createOperationCallExp())); |
| 220 | |
| 221 | newChildDescriptors.add |
| 222 | (createChildParameter |
| 223 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 224 | EssentialOCLFactory.eINSTANCE.createPropertyCallExp())); |
| 225 | |
| 226 | newChildDescriptors.add |
| 227 | (createChildParameter |
| 228 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 229 | EssentialOCLFactory.eINSTANCE.createRealLiteralExp())); |
| 230 | |
| 231 | newChildDescriptors.add |
| 232 | (createChildParameter |
| 233 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 234 | EssentialOCLFactory.eINSTANCE.createStringLiteralExp())); |
| 235 | |
| 236 | newChildDescriptors.add |
| 237 | (createChildParameter |
| 238 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 239 | EssentialOCLFactory.eINSTANCE.createTupleLiteralExp())); |
| 240 | |
| 241 | newChildDescriptors.add |
| 242 | (createChildParameter |
| 243 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 244 | EssentialOCLFactory.eINSTANCE.createTypeExp())); |
| 245 | |
| 246 | newChildDescriptors.add |
| 247 | (createChildParameter |
| 248 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 249 | EssentialOCLFactory.eINSTANCE.createUnlimitedNaturalExp())); |
| 250 | |
| 251 | newChildDescriptors.add |
| 252 | (createChildParameter |
| 253 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 254 | EssentialOCLFactory.eINSTANCE.createVariableExp())); |
| 255 | |
| 256 | newChildDescriptors.add |
| 257 | (createChildParameter |
| 258 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 259 | QVTRelationFactory.eINSTANCE.createOppositePropertyCallExp())); |
| 260 | |
| 261 | newChildDescriptors.add |
| 262 | (createChildParameter |
| 263 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 264 | QVTRelationFactory.eINSTANCE.createRelationCallExp())); |
| 265 | |
| 266 | newChildDescriptors.add |
| 267 | (createChildParameter |
| 268 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 269 | QVTTemplateFactory.eINSTANCE.createCollectionTemplateExp())); |
| 270 | |
| 271 | newChildDescriptors.add |
| 272 | (createChildParameter |
| 273 | (QVTBasePackage.Literals.PREDICATE__CONDITION_EXPRESSION, |
| 274 | QVTTemplateFactory.eINSTANCE.createObjectTemplateExp())); |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * Return the resource locator for this item provider's resources. |
| 279 | * <!-- begin-user-doc --> |
| 280 | * <!-- end-user-doc --> |
| 281 | * @generated |
| 282 | */ |
| 283 | @Override |
| 284 | public ResourceLocator getResourceLocator() { |
| 285 | return QvtmodelsEditPlugin.INSTANCE; |
| 286 | } |
| 287 | |
| 288 | } |