| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package QVTRelation.provider; |
| 8 | |
| 9 | |
| 10 | import EMOF.provider.ElementItemProvider; |
| 11 | import EMOF.provider.QvtmodelsEditPlugin; |
| 12 | |
| 13 | import EssentialOCL.EssentialOCLFactory; |
| 14 | |
| 15 | import QVTRelation.QVTRelationFactory; |
| 16 | import QVTRelation.QVTRelationPackage; |
| 17 | import QVTRelation.RelationDomainAssignment; |
| 18 | |
| 19 | import QVTTemplate.QVTTemplateFactory; |
| 20 | |
| 21 | import java.util.Collection; |
| 22 | import java.util.List; |
| 23 | |
| 24 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 25 | import org.eclipse.emf.common.notify.Notification; |
| 26 | |
| 27 | import org.eclipse.emf.common.util.ResourceLocator; |
| 28 | |
| 29 | import org.eclipse.emf.ecore.EStructuralFeature; |
| 30 | |
| 31 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| 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 QVTRelation.RelationDomainAssignment} object. |
| 42 | * <!-- begin-user-doc --> |
| 43 | * <!-- end-user-doc --> |
| 44 | * @generated |
| 45 | */ |
| 46 | public class RelationDomainAssignmentItemProvider |
| 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 RelationDomainAssignmentItemProvider(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 | addVariablePropertyDescriptor(object); |
| 76 | } |
| 77 | return itemPropertyDescriptors; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * This adds a property descriptor for the Variable feature. |
| 82 | * <!-- begin-user-doc --> |
| 83 | * <!-- end-user-doc --> |
| 84 | * @generated |
| 85 | */ |
| 86 | protected void addVariablePropertyDescriptor(Object object) { |
| 87 | itemPropertyDescriptors.add |
| 88 | (createItemPropertyDescriptor |
| 89 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 90 | getResourceLocator(), |
| 91 | getString("_UI_RelationDomainAssignment_variable_feature"), |
| 92 | getString("_UI_PropertyDescriptor_description", "_UI_RelationDomainAssignment_variable_feature", "_UI_RelationDomainAssignment_type"), |
| 93 | QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VARIABLE, |
| 94 | true, |
| 95 | false, |
| 96 | true, |
| 97 | null, |
| 98 | null, |
| 99 | null)); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| 104 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| 105 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| 106 | * <!-- begin-user-doc --> |
| 107 | * <!-- end-user-doc --> |
| 108 | * @generated |
| 109 | */ |
| 110 | @Override |
| 111 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
| 112 | if (childrenFeatures == null) { |
| 113 | super.getChildrenFeatures(object); |
| 114 | childrenFeatures.add(QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP); |
| 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 RelationDomainAssignment.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/RelationDomainAssignment")); |
| 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 | return getString("_UI_RelationDomainAssignment_type"); |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 156 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 157 | * <!-- begin-user-doc --> |
| 158 | * <!-- end-user-doc --> |
| 159 | * @generated |
| 160 | */ |
| 161 | @Override |
| 162 | public void notifyChanged(Notification notification) { |
| 163 | updateChildren(notification); |
| 164 | |
| 165 | switch (notification.getFeatureID(RelationDomainAssignment.class)) { |
| 166 | case QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP: |
| 167 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 168 | return; |
| 169 | } |
| 170 | super.notifyChanged(notification); |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 175 | * that can be created under this object. |
| 176 | * <!-- begin-user-doc --> |
| 177 | * <!-- end-user-doc --> |
| 178 | * @generated |
| 179 | */ |
| 180 | @Override |
| 181 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 182 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 183 | |
| 184 | newChildDescriptors.add |
| 185 | (createChildParameter |
| 186 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 187 | QVTRelationFactory.eINSTANCE.createOppositePropertyCallExp())); |
| 188 | |
| 189 | newChildDescriptors.add |
| 190 | (createChildParameter |
| 191 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 192 | QVTRelationFactory.eINSTANCE.createRelationCallExp())); |
| 193 | |
| 194 | newChildDescriptors.add |
| 195 | (createChildParameter |
| 196 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 197 | EssentialOCLFactory.eINSTANCE.createBooleanLiteralExp())); |
| 198 | |
| 199 | newChildDescriptors.add |
| 200 | (createChildParameter |
| 201 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 202 | EssentialOCLFactory.eINSTANCE.createCollectionLiteralExp())); |
| 203 | |
| 204 | newChildDescriptors.add |
| 205 | (createChildParameter |
| 206 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 207 | EssentialOCLFactory.eINSTANCE.createEnumLiteralExp())); |
| 208 | |
| 209 | newChildDescriptors.add |
| 210 | (createChildParameter |
| 211 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 212 | EssentialOCLFactory.eINSTANCE.createIfExp())); |
| 213 | |
| 214 | newChildDescriptors.add |
| 215 | (createChildParameter |
| 216 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 217 | EssentialOCLFactory.eINSTANCE.createIntegerLiteralExp())); |
| 218 | |
| 219 | newChildDescriptors.add |
| 220 | (createChildParameter |
| 221 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 222 | EssentialOCLFactory.eINSTANCE.createInvalidLiteralExp())); |
| 223 | |
| 224 | newChildDescriptors.add |
| 225 | (createChildParameter |
| 226 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 227 | EssentialOCLFactory.eINSTANCE.createIterateExp())); |
| 228 | |
| 229 | newChildDescriptors.add |
| 230 | (createChildParameter |
| 231 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 232 | EssentialOCLFactory.eINSTANCE.createIteratorExp())); |
| 233 | |
| 234 | newChildDescriptors.add |
| 235 | (createChildParameter |
| 236 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 237 | EssentialOCLFactory.eINSTANCE.createLetExp())); |
| 238 | |
| 239 | newChildDescriptors.add |
| 240 | (createChildParameter |
| 241 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 242 | EssentialOCLFactory.eINSTANCE.createNavigationCallExp())); |
| 243 | |
| 244 | newChildDescriptors.add |
| 245 | (createChildParameter |
| 246 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 247 | EssentialOCLFactory.eINSTANCE.createNullLiteralExp())); |
| 248 | |
| 249 | newChildDescriptors.add |
| 250 | (createChildParameter |
| 251 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 252 | EssentialOCLFactory.eINSTANCE.createOperationCallExp())); |
| 253 | |
| 254 | newChildDescriptors.add |
| 255 | (createChildParameter |
| 256 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 257 | EssentialOCLFactory.eINSTANCE.createPropertyCallExp())); |
| 258 | |
| 259 | newChildDescriptors.add |
| 260 | (createChildParameter |
| 261 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 262 | EssentialOCLFactory.eINSTANCE.createRealLiteralExp())); |
| 263 | |
| 264 | newChildDescriptors.add |
| 265 | (createChildParameter |
| 266 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 267 | EssentialOCLFactory.eINSTANCE.createStringLiteralExp())); |
| 268 | |
| 269 | newChildDescriptors.add |
| 270 | (createChildParameter |
| 271 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 272 | EssentialOCLFactory.eINSTANCE.createTupleLiteralExp())); |
| 273 | |
| 274 | newChildDescriptors.add |
| 275 | (createChildParameter |
| 276 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 277 | EssentialOCLFactory.eINSTANCE.createTypeExp())); |
| 278 | |
| 279 | newChildDescriptors.add |
| 280 | (createChildParameter |
| 281 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 282 | EssentialOCLFactory.eINSTANCE.createUnlimitedNaturalExp())); |
| 283 | |
| 284 | newChildDescriptors.add |
| 285 | (createChildParameter |
| 286 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 287 | EssentialOCLFactory.eINSTANCE.createVariableExp())); |
| 288 | |
| 289 | newChildDescriptors.add |
| 290 | (createChildParameter |
| 291 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 292 | QVTTemplateFactory.eINSTANCE.createCollectionTemplateExp())); |
| 293 | |
| 294 | newChildDescriptors.add |
| 295 | (createChildParameter |
| 296 | (QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, |
| 297 | QVTTemplateFactory.eINSTANCE.createObjectTemplateExp())); |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * Return the resource locator for this item provider's resources. |
| 302 | * <!-- begin-user-doc --> |
| 303 | * <!-- end-user-doc --> |
| 304 | * @generated |
| 305 | */ |
| 306 | @Override |
| 307 | public ResourceLocator getResourceLocator() { |
| 308 | return QvtmodelsEditPlugin.INSTANCE; |
| 309 | } |
| 310 | |
| 311 | } |