| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package QVTRelation.provider; |
| 8 | |
| 9 | |
| 10 | import EMOF.provider.QvtmodelsEditPlugin; |
| 11 | |
| 12 | import QVTBase.provider.PatternItemProvider; |
| 13 | |
| 14 | import QVTRelation.DomainPattern; |
| 15 | import QVTRelation.QVTRelationPackage; |
| 16 | |
| 17 | import QVTTemplate.QVTTemplateFactory; |
| 18 | |
| 19 | import java.util.Collection; |
| 20 | import java.util.List; |
| 21 | |
| 22 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 23 | import org.eclipse.emf.common.notify.Notification; |
| 24 | |
| 25 | import org.eclipse.emf.common.util.ResourceLocator; |
| 26 | |
| 27 | import org.eclipse.emf.ecore.EStructuralFeature; |
| 28 | |
| 29 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 30 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| 31 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| 32 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
| 33 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
| 34 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
| 35 | import org.eclipse.emf.edit.provider.ViewerNotification; |
| 36 | |
| 37 | /** |
| 38 | * This is the item provider adapter for a {@link QVTRelation.DomainPattern} object. |
| 39 | * <!-- begin-user-doc --> |
| 40 | * <!-- end-user-doc --> |
| 41 | * @generated |
| 42 | */ |
| 43 | public class DomainPatternItemProvider |
| 44 | extends PatternItemProvider |
| 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 DomainPatternItemProvider(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 | } |
| 73 | return itemPropertyDescriptors; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| 78 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| 79 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @generated |
| 83 | */ |
| 84 | @Override |
| 85 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
| 86 | if (childrenFeatures == null) { |
| 87 | super.getChildrenFeatures(object); |
| 88 | childrenFeatures.add(QVTRelationPackage.Literals.DOMAIN_PATTERN__TEMPLATE_EXPRESSION); |
| 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 DomainPattern.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/DomainPattern")); |
| 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_DomainPattern_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(DomainPattern.class)) { |
| 140 | case QVTRelationPackage.DOMAIN_PATTERN__TEMPLATE_EXPRESSION: |
| 141 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 142 | return; |
| 143 | } |
| 144 | super.notifyChanged(notification); |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 149 | * that can be created under this object. |
| 150 | * <!-- begin-user-doc --> |
| 151 | * <!-- end-user-doc --> |
| 152 | * @generated |
| 153 | */ |
| 154 | @Override |
| 155 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 156 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 157 | |
| 158 | newChildDescriptors.add |
| 159 | (createChildParameter |
| 160 | (QVTRelationPackage.Literals.DOMAIN_PATTERN__TEMPLATE_EXPRESSION, |
| 161 | QVTTemplateFactory.eINSTANCE.createCollectionTemplateExp())); |
| 162 | |
| 163 | newChildDescriptors.add |
| 164 | (createChildParameter |
| 165 | (QVTRelationPackage.Literals.DOMAIN_PATTERN__TEMPLATE_EXPRESSION, |
| 166 | QVTTemplateFactory.eINSTANCE.createObjectTemplateExp())); |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * Return the resource locator for this item provider's resources. |
| 171 | * <!-- begin-user-doc --> |
| 172 | * <!-- end-user-doc --> |
| 173 | * @generated |
| 174 | */ |
| 175 | @Override |
| 176 | public ResourceLocator getResourceLocator() { |
| 177 | return QvtmodelsEditPlugin.INSTANCE; |
| 178 | } |
| 179 | |
| 180 | } |