|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 package cenrep.provider; |
|
18 |
|
19 |
|
20 import java.util.Collection; |
|
21 import java.util.List; |
|
22 |
|
23 import org.eclipse.emf.common.notify.AdapterFactory; |
|
24 import org.eclipse.emf.common.notify.Notification; |
|
25 import org.eclipse.emf.common.util.ResourceLocator; |
|
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.IItemPropertySource; |
|
30 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
|
31 import org.eclipse.emf.edit.provider.ITableItemLabelProvider; |
|
32 import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
|
33 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
|
34 import org.eclipse.emf.edit.provider.ViewerNotification; |
|
35 |
|
36 import cenrep.Access; |
|
37 import cenrep.CenrepFactory; |
|
38 import cenrep.CenrepPackage; |
|
39 |
|
40 /** |
|
41 * This is the item provider adapter for a {@link cenrep.Access} object. |
|
42 * <!-- begin-user-doc --> |
|
43 * <!-- end-user-doc --> |
|
44 * @generated NOT |
|
45 */ |
|
46 public class AccessItemProvider |
|
47 extends CommonAttrsItemProvider |
|
48 implements |
|
49 IEditingDomainItemProvider, |
|
50 IStructuredItemContentProvider, |
|
51 ITreeItemContentProvider, |
|
52 IItemLabelProvider, |
|
53 IItemPropertySource, |
|
54 ITableItemLabelProvider{ |
|
55 |
|
56 public static final Access ZERO_ACCESS = CenrepFactory.eINSTANCE.createAccess(); |
|
57 |
|
58 /** |
|
59 * This constructs an instance from a factory and a notifier. |
|
60 * <!-- begin-user-doc --> |
|
61 * <!-- end-user-doc --> |
|
62 * @generated |
|
63 */ |
|
64 public AccessItemProvider(AdapterFactory adapterFactory) { |
|
65 super(adapterFactory); |
|
66 } |
|
67 |
|
68 public Object getColumnImage(Object object, int columnIndex) { |
|
69 return null; |
|
70 } |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 public String getColumnText(Object object, int columnIndex) { |
|
76 if(object.equals(ZERO_ACCESS))return null; |
|
77 Access access = (Access)object; |
|
78 switch(columnIndex){ |
|
79 case 0: |
|
80 return access.getType().getLiteral(); |
|
81 case 1: |
|
82 return access.getSid(); |
|
83 } |
|
84 return null; |
|
85 } |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 /** |
|
91 * This returns the property descriptors for the adapted class. |
|
92 * <!-- begin-user-doc --> |
|
93 * <!-- end-user-doc --> |
|
94 * @generated |
|
95 */ |
|
96 public List getPropertyDescriptors(Object object) { |
|
97 if (itemPropertyDescriptors == null) { |
|
98 super.getPropertyDescriptors(object); |
|
99 |
|
100 addTypePropertyDescriptor(object); |
|
101 addCapabilitiesPropertyDescriptor(object); |
|
102 addSidPropertyDescriptor(object); |
|
103 } |
|
104 return itemPropertyDescriptors; |
|
105 } |
|
106 |
|
107 /** |
|
108 * This adds a property descriptor for the Type feature. |
|
109 * <!-- begin-user-doc --> |
|
110 * <!-- end-user-doc --> |
|
111 * @generated |
|
112 */ |
|
113 protected void addTypePropertyDescriptor(Object object) { |
|
114 itemPropertyDescriptors.add |
|
115 (createItemPropertyDescriptor |
|
116 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
117 getResourceLocator(), |
|
118 getString("_UI_Access_type_feature"), |
|
119 getString("_UI_PropertyDescriptor_description", "_UI_Access_type_feature", "_UI_Access_type"), |
|
120 CenrepPackage.Literals.ACCESS__TYPE, |
|
121 true, |
|
122 false, |
|
123 false, |
|
124 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
|
125 null, |
|
126 null)); |
|
127 } |
|
128 |
|
129 /** |
|
130 * This adds a property descriptor for the Capabilities feature. |
|
131 * <!-- begin-user-doc --> |
|
132 * <!-- end-user-doc --> |
|
133 * @generated |
|
134 */ |
|
135 protected void addCapabilitiesPropertyDescriptor(Object object) { |
|
136 itemPropertyDescriptors.add |
|
137 (createItemPropertyDescriptor |
|
138 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
139 getResourceLocator(), |
|
140 getString("_UI_Access_capabilities_feature"), |
|
141 getString("_UI_PropertyDescriptor_description", "_UI_Access_capabilities_feature", "_UI_Access_type"), |
|
142 CenrepPackage.Literals.ACCESS__CAPABILITIES, |
|
143 true, |
|
144 false, |
|
145 false, |
|
146 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
|
147 null, |
|
148 null)); |
|
149 } |
|
150 |
|
151 /** |
|
152 * This adds a property descriptor for the Sid feature. |
|
153 * <!-- begin-user-doc --> |
|
154 * <!-- end-user-doc --> |
|
155 * @generated |
|
156 */ |
|
157 protected void addSidPropertyDescriptor(Object object) { |
|
158 itemPropertyDescriptors.add |
|
159 (createItemPropertyDescriptor |
|
160 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
161 getResourceLocator(), |
|
162 getString("_UI_Access_sid_feature"), |
|
163 getString("_UI_PropertyDescriptor_description", "_UI_Access_sid_feature", "_UI_Access_type"), |
|
164 CenrepPackage.Literals.ACCESS__SID, |
|
165 true, |
|
166 false, |
|
167 false, |
|
168 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
|
169 null, |
|
170 null)); |
|
171 } |
|
172 |
|
173 |
|
174 |
|
175 /** |
|
176 * This returns Access.gif. |
|
177 * <!-- begin-user-doc --> |
|
178 * <!-- end-user-doc --> |
|
179 * @generated |
|
180 */ |
|
181 public Object getImage(Object object) { |
|
182 return overlayImage(object, getResourceLocator().getImage("full/obj16/Access")); |
|
183 } |
|
184 |
|
185 /** |
|
186 * This returns the label text for the adapted class. |
|
187 * <!-- begin-user-doc --> |
|
188 * <!-- end-user-doc --> |
|
189 * @generated |
|
190 */ |
|
191 public String getText(Object object) { |
|
192 String label = ((Access)object).getId(); |
|
193 return label == null || label.length() == 0 ? |
|
194 getString("_UI_Access_type") : |
|
195 getString("_UI_Access_type") + " " + label; |
|
196 } |
|
197 |
|
198 /** |
|
199 * This handles model notifications by calling {@link #updateChildren} to update any cached |
|
200 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
|
201 * <!-- begin-user-doc --> |
|
202 * <!-- end-user-doc --> |
|
203 * @generated |
|
204 */ |
|
205 public void notifyChanged(Notification notification) { |
|
206 updateChildren(notification); |
|
207 |
|
208 switch (notification.getFeatureID(Access.class)) { |
|
209 case CenrepPackage.ACCESS__TYPE: |
|
210 case CenrepPackage.ACCESS__CAPABILITIES: |
|
211 case CenrepPackage.ACCESS__SID: |
|
212 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
|
213 return; |
|
214 } |
|
215 super.notifyChanged(notification); |
|
216 } |
|
217 |
|
218 /** |
|
219 * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s |
|
220 * describing all of the children that can be created under this object. |
|
221 * <!-- begin-user-doc --> |
|
222 * <!-- end-user-doc --> |
|
223 * @generated |
|
224 */ |
|
225 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { |
|
226 super.collectNewChildDescriptors(newChildDescriptors, object); |
|
227 } |
|
228 |
|
229 /** |
|
230 * Return the resource locator for this item provider's resources. |
|
231 * <!-- begin-user-doc --> |
|
232 * <!-- end-user-doc --> |
|
233 * @generated |
|
234 */ |
|
235 public ResourceLocator getResourceLocator() { |
|
236 return CRPluginModelEditPlugin.INSTANCE; |
|
237 } |
|
238 |
|
239 } |