1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.designdecision.GDoF.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.ChangeableElementDescription; |
11 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.GDoFFactory; |
12 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.GDoFPackage; |
13 | |
14 | import de.uka.ipd.sdq.pcm.designdecision.provider.DesignDecisionEditPlugin; |
15 | |
16 | import java.util.Collection; |
17 | import java.util.List; |
18 | |
19 | import org.eclipse.emf.common.notify.AdapterFactory; |
20 | import org.eclipse.emf.common.notify.Notification; |
21 | |
22 | import org.eclipse.emf.common.util.ResourceLocator; |
23 | |
24 | import org.eclipse.emf.ecore.EStructuralFeature; |
25 | |
26 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
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.uka.ipd.sdq.pcm.designdecision.GDoF.ChangeableElementDescription} object. |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @generated |
41 | */ |
42 | public class ChangeableElementDescriptionItemProvider |
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 ChangeableElementDescriptionItemProvider(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 | addChangeablePropertyDescriptor(object); |
72 | } |
73 | return itemPropertyDescriptors; |
74 | } |
75 | |
76 | /** |
77 | * This adds a property descriptor for the Changeable feature. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | protected void addChangeablePropertyDescriptor(Object object) { |
83 | itemPropertyDescriptors.add |
84 | (createItemPropertyDescriptor |
85 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
86 | getResourceLocator(), |
87 | getString("_UI_ChangeableElementDescription_changeable_feature"), |
88 | getString("_UI_PropertyDescriptor_description", "_UI_ChangeableElementDescription_changeable_feature", "_UI_ChangeableElementDescription_type"), |
89 | GDoFPackage.Literals.CHANGEABLE_ELEMENT_DESCRIPTION__CHANGEABLE, |
90 | true, |
91 | false, |
92 | true, |
93 | null, |
94 | null, |
95 | null)); |
96 | } |
97 | |
98 | /** |
99 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
100 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
101 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
102 | * <!-- begin-user-doc --> |
103 | * <!-- end-user-doc --> |
104 | * @generated |
105 | */ |
106 | @Override |
107 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
108 | if (childrenFeatures == null) { |
109 | super.getChildrenFeatures(object); |
110 | childrenFeatures.add(GDoFPackage.Literals.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE); |
111 | childrenFeatures.add(GDoFPackage.Literals.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE); |
112 | } |
113 | return childrenFeatures; |
114 | } |
115 | |
116 | /** |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | @Override |
122 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
123 | // Check the type of the specified child object and return the proper feature to use for |
124 | // adding (see {@link AddCommand}) it as a child. |
125 | |
126 | return super.getChildFeature(object, child); |
127 | } |
128 | |
129 | /** |
130 | * This returns ChangeableElementDescription.gif. |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | @Override |
136 | public Object getImage(Object object) { |
137 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ChangeableElementDescription")); |
138 | } |
139 | |
140 | /** |
141 | * This returns the label text for the adapted class. |
142 | * <!-- begin-user-doc --> |
143 | * <!-- end-user-doc --> |
144 | * @generated |
145 | */ |
146 | @Override |
147 | public String getText(Object object) { |
148 | return getString("_UI_ChangeableElementDescription_type"); |
149 | } |
150 | |
151 | /** |
152 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
153 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
154 | * <!-- begin-user-doc --> |
155 | * <!-- end-user-doc --> |
156 | * @generated |
157 | */ |
158 | @Override |
159 | public void notifyChanged(Notification notification) { |
160 | updateChildren(notification); |
161 | |
162 | switch (notification.getFeatureID(ChangeableElementDescription.class)) { |
163 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE: |
164 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE: |
165 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
166 | return; |
167 | } |
168 | super.notifyChanged(notification); |
169 | } |
170 | |
171 | /** |
172 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
173 | * that can be created under this object. |
174 | * <!-- begin-user-doc --> |
175 | * <!-- end-user-doc --> |
176 | * @generated |
177 | */ |
178 | @Override |
179 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
180 | super.collectNewChildDescriptors(newChildDescriptors, object); |
181 | |
182 | newChildDescriptors.add |
183 | (createChildParameter |
184 | (GDoFPackage.Literals.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE, |
185 | GDoFFactory.eINSTANCE.createValueRule())); |
186 | |
187 | newChildDescriptors.add |
188 | (createChildParameter |
189 | (GDoFPackage.Literals.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE, |
190 | GDoFFactory.eINSTANCE.createInstanceSelectionRule())); |
191 | |
192 | newChildDescriptors.add |
193 | (createChildParameter |
194 | (GDoFPackage.Literals.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE, |
195 | GDoFFactory.eINSTANCE.createStaticSelectionRule())); |
196 | } |
197 | |
198 | /** |
199 | * Return the resource locator for this item provider's resources. |
200 | * <!-- begin-user-doc --> |
201 | * <!-- end-user-doc --> |
202 | * @generated |
203 | */ |
204 | @Override |
205 | public ResourceLocator getResourceLocator() { |
206 | return DesignDecisionEditPlugin.INSTANCE; |
207 | } |
208 | |
209 | } |