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