| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package edu.kit.ipd.sdq.completionfeaturemodel.provider; |
| 8 | |
| 9 | |
| 10 | import EssentialOCL.EssentialOCLFactory; |
| 11 | |
| 12 | import edu.kit.ipd.sdq.completionfeaturemodel.DisambiguationRule; |
| 13 | import edu.kit.ipd.sdq.completionfeaturemodel.completionfeaturemodelPackage; |
| 14 | |
| 15 | import java.util.Collection; |
| 16 | import java.util.List; |
| 17 | |
| 18 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 19 | import org.eclipse.emf.common.notify.Notification; |
| 20 | |
| 21 | import org.eclipse.emf.common.util.ResourceLocator; |
| 22 | |
| 23 | import org.eclipse.emf.ecore.EStructuralFeature; |
| 24 | |
| 25 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| 26 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 27 | import org.eclipse.emf.edit.provider.IItemColorProvider; |
| 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 edu.kit.ipd.sdq.completionfeaturemodel.DisambiguationRule} object. |
| 38 | * <!-- begin-user-doc --> |
| 39 | * <!-- end-user-doc --> |
| 40 | * @generated |
| 41 | */ |
| 42 | public class DisambiguationRuleItemProvider |
| 43 | extends ItemProviderAdapter |
| 44 | implements |
| 45 | IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider { |
| 46 | /** |
| 47 | * This constructs an instance from a factory and a notifier. |
| 48 | * <!-- begin-user-doc --> |
| 49 | * <!-- end-user-doc --> |
| 50 | * @generated |
| 51 | */ |
| 52 | public DisambiguationRuleItemProvider(AdapterFactory adapterFactory) { |
| 53 | super(adapterFactory); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * This returns the property descriptors for the adapted class. |
| 58 | * <!-- begin-user-doc --> |
| 59 | * <!-- end-user-doc --> |
| 60 | * @generated |
| 61 | */ |
| 62 | @Override |
| 63 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 64 | if (itemPropertyDescriptors == null) { |
| 65 | super.getPropertyDescriptors(object); |
| 66 | |
| 67 | addFeaturePropertyDescriptor(object); |
| 68 | addTransformationFragmentPropertyDescriptor(object); |
| 69 | } |
| 70 | return itemPropertyDescriptors; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * This adds a property descriptor for the Feature feature. |
| 75 | * <!-- begin-user-doc --> |
| 76 | * <!-- end-user-doc --> |
| 77 | * @generated |
| 78 | */ |
| 79 | protected void addFeaturePropertyDescriptor(Object object) { |
| 80 | itemPropertyDescriptors.add |
| 81 | (createItemPropertyDescriptor |
| 82 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 83 | getResourceLocator(), |
| 84 | getString("_UI_DisambiguationRule_feature_feature"), |
| 85 | getString("_UI_PropertyDescriptor_description", "_UI_DisambiguationRule_feature_feature", "_UI_DisambiguationRule_type"), |
| 86 | completionfeaturemodelPackage.Literals.DISAMBIGUATION_RULE__FEATURE, |
| 87 | true, |
| 88 | false, |
| 89 | true, |
| 90 | null, |
| 91 | null, |
| 92 | null)); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * This adds a property descriptor for the Transformation Fragment feature. |
| 97 | * <!-- begin-user-doc --> |
| 98 | * <!-- end-user-doc --> |
| 99 | * @generated |
| 100 | */ |
| 101 | protected void addTransformationFragmentPropertyDescriptor(Object object) { |
| 102 | itemPropertyDescriptors.add |
| 103 | (createItemPropertyDescriptor |
| 104 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 105 | getResourceLocator(), |
| 106 | getString("_UI_DisambiguationRule_transformationFragment_feature"), |
| 107 | getString("_UI_PropertyDescriptor_description", "_UI_DisambiguationRule_transformationFragment_feature", "_UI_DisambiguationRule_type"), |
| 108 | completionfeaturemodelPackage.Literals.DISAMBIGUATION_RULE__TRANSFORMATION_FRAGMENT, |
| 109 | true, |
| 110 | false, |
| 111 | true, |
| 112 | null, |
| 113 | null, |
| 114 | null)); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| 119 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| 120 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| 121 | * <!-- begin-user-doc --> |
| 122 | * <!-- end-user-doc --> |
| 123 | * @generated |
| 124 | */ |
| 125 | @Override |
| 126 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
| 127 | if (childrenFeatures == null) { |
| 128 | super.getChildrenFeatures(object); |
| 129 | childrenFeatures.add(completionfeaturemodelPackage.Literals.DISAMBIGUATION_RULE__DISAMBIGUATION_CONDITION); |
| 130 | } |
| 131 | return childrenFeatures; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * <!-- begin-user-doc --> |
| 136 | * <!-- end-user-doc --> |
| 137 | * @generated |
| 138 | */ |
| 139 | @Override |
| 140 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
| 141 | // Check the type of the specified child object and return the proper feature to use for |
| 142 | // adding (see {@link AddCommand}) it as a child. |
| 143 | |
| 144 | return super.getChildFeature(object, child); |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * This returns DisambiguationRule.gif. |
| 149 | * <!-- begin-user-doc --> |
| 150 | * <!-- end-user-doc --> |
| 151 | * @generated |
| 152 | */ |
| 153 | @Override |
| 154 | public Object getImage(Object object) { |
| 155 | return overlayImage(object, getResourceLocator().getImage("full/obj16/DisambiguationRule")); |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * This returns the label text for the adapted class. |
| 160 | * <!-- begin-user-doc --> |
| 161 | * <!-- end-user-doc --> |
| 162 | * @generated |
| 163 | */ |
| 164 | @Override |
| 165 | public String getText(Object object) { |
| 166 | return getString("_UI_DisambiguationRule_type"); |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 171 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 172 | * <!-- begin-user-doc --> |
| 173 | * <!-- end-user-doc --> |
| 174 | * @generated |
| 175 | */ |
| 176 | @Override |
| 177 | public void notifyChanged(Notification notification) { |
| 178 | updateChildren(notification); |
| 179 | |
| 180 | switch (notification.getFeatureID(DisambiguationRule.class)) { |
| 181 | case completionfeaturemodelPackage.DISAMBIGUATION_RULE__DISAMBIGUATION_CONDITION: |
| 182 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 183 | return; |
| 184 | } |
| 185 | super.notifyChanged(notification); |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 190 | * that can be created under this object. |
| 191 | * <!-- begin-user-doc --> |
| 192 | * <!-- end-user-doc --> |
| 193 | * @generated |
| 194 | */ |
| 195 | @Override |
| 196 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 197 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 198 | |
| 199 | newChildDescriptors.add |
| 200 | (createChildParameter |
| 201 | (completionfeaturemodelPackage.Literals.DISAMBIGUATION_RULE__DISAMBIGUATION_CONDITION, |
| 202 | EssentialOCLFactory.eINSTANCE.createOperationCallExp())); |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * Return the resource locator for this item provider's resources. |
| 207 | * <!-- begin-user-doc --> |
| 208 | * <!-- end-user-doc --> |
| 209 | * @generated |
| 210 | */ |
| 211 | @Override |
| 212 | public ResourceLocator getResourceLocator() { |
| 213 | return CompletionfeaturemodelEditPlugin.INSTANCE; |
| 214 | } |
| 215 | |
| 216 | } |