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 QVTBase.Pattern; |
14 | import QVTBase.QVTBaseFactory; |
15 | import QVTBase.QVTBasePackage; |
16 | |
17 | import java.util.Collection; |
18 | import java.util.List; |
19 | |
20 | import org.eclipse.emf.common.notify.AdapterFactory; |
21 | import org.eclipse.emf.common.notify.Notification; |
22 | |
23 | import org.eclipse.emf.common.util.ResourceLocator; |
24 | |
25 | import org.eclipse.emf.ecore.EStructuralFeature; |
26 | |
27 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
28 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
29 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
30 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
31 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
32 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
33 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
34 | import org.eclipse.emf.edit.provider.ViewerNotification; |
35 | |
36 | /** |
37 | * This is the item provider adapter for a {@link QVTBase.Pattern} object. |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @generated |
41 | */ |
42 | public class PatternItemProvider |
43 | extends ElementItemProvider |
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 PatternItemProvider(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 | addBindsToPropertyDescriptor(object); |
72 | } |
73 | return itemPropertyDescriptors; |
74 | } |
75 | |
76 | /** |
77 | * This adds a property descriptor for the Binds To feature. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | protected void addBindsToPropertyDescriptor(Object object) { |
83 | itemPropertyDescriptors.add |
84 | (createItemPropertyDescriptor |
85 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
86 | getResourceLocator(), |
87 | getString("_UI_Pattern_bindsTo_feature"), |
88 | getString("_UI_PropertyDescriptor_description", "_UI_Pattern_bindsTo_feature", "_UI_Pattern_type"), |
89 | QVTBasePackage.Literals.PATTERN__BINDS_TO, |
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(QVTBasePackage.Literals.PATTERN__PREDICATE); |
111 | } |
112 | return childrenFeatures; |
113 | } |
114 | |
115 | /** |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | @Override |
121 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
122 | // Check the type of the specified child object and return the proper feature to use for |
123 | // adding (see {@link AddCommand}) it as a child. |
124 | |
125 | return super.getChildFeature(object, child); |
126 | } |
127 | |
128 | /** |
129 | * This returns Pattern.gif. |
130 | * <!-- begin-user-doc --> |
131 | * <!-- end-user-doc --> |
132 | * @generated |
133 | */ |
134 | @Override |
135 | public Object getImage(Object object) { |
136 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Pattern")); |
137 | } |
138 | |
139 | /** |
140 | * This returns the label text for the adapted class. |
141 | * <!-- begin-user-doc --> |
142 | * <!-- end-user-doc --> |
143 | * @generated |
144 | */ |
145 | @Override |
146 | public String getText(Object object) { |
147 | return getString("_UI_Pattern_type"); |
148 | } |
149 | |
150 | /** |
151 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
152 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
153 | * <!-- begin-user-doc --> |
154 | * <!-- end-user-doc --> |
155 | * @generated |
156 | */ |
157 | @Override |
158 | public void notifyChanged(Notification notification) { |
159 | updateChildren(notification); |
160 | |
161 | switch (notification.getFeatureID(Pattern.class)) { |
162 | case QVTBasePackage.PATTERN__PREDICATE: |
163 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
164 | return; |
165 | } |
166 | super.notifyChanged(notification); |
167 | } |
168 | |
169 | /** |
170 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
171 | * that can be created under this object. |
172 | * <!-- begin-user-doc --> |
173 | * <!-- end-user-doc --> |
174 | * @generated |
175 | */ |
176 | @Override |
177 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
178 | super.collectNewChildDescriptors(newChildDescriptors, object); |
179 | |
180 | newChildDescriptors.add |
181 | (createChildParameter |
182 | (QVTBasePackage.Literals.PATTERN__PREDICATE, |
183 | QVTBaseFactory.eINSTANCE.createPredicate())); |
184 | } |
185 | |
186 | /** |
187 | * Return the resource locator for this item provider's resources. |
188 | * <!-- begin-user-doc --> |
189 | * <!-- end-user-doc --> |
190 | * @generated |
191 | */ |
192 | @Override |
193 | public ResourceLocator getResourceLocator() { |
194 | return QvtmodelsEditPlugin.INSTANCE; |
195 | } |
196 | |
197 | } |