1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EMOF.provider; |
8 | |
9 | |
10 | import EMOF.EMOFPackage; |
11 | import EMOF.Tag; |
12 | |
13 | import java.util.Collection; |
14 | import java.util.List; |
15 | |
16 | import org.eclipse.emf.common.notify.AdapterFactory; |
17 | import org.eclipse.emf.common.notify.Notification; |
18 | |
19 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
20 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
21 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
22 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
23 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
24 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
25 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
26 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
27 | import org.eclipse.emf.edit.provider.ViewerNotification; |
28 | |
29 | /** |
30 | * This is the item provider adapter for a {@link EMOF.Tag} object. |
31 | * <!-- begin-user-doc --> |
32 | * <!-- end-user-doc --> |
33 | * @generated |
34 | */ |
35 | public class TagItemProvider |
36 | extends ElementItemProvider |
37 | implements |
38 | IEditingDomainItemProvider, |
39 | IStructuredItemContentProvider, |
40 | ITreeItemContentProvider, |
41 | IItemLabelProvider, |
42 | IItemPropertySource { |
43 | /** |
44 | * This constructs an instance from a factory and a notifier. |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @generated |
48 | */ |
49 | public TagItemProvider(AdapterFactory adapterFactory) { |
50 | super(adapterFactory); |
51 | } |
52 | |
53 | /** |
54 | * This returns the property descriptors for the adapted class. |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @generated |
58 | */ |
59 | @Override |
60 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
61 | if (itemPropertyDescriptors == null) { |
62 | super.getPropertyDescriptors(object); |
63 | |
64 | addElementPropertyDescriptor(object); |
65 | addNamePropertyDescriptor(object); |
66 | addValuePropertyDescriptor(object); |
67 | } |
68 | return itemPropertyDescriptors; |
69 | } |
70 | |
71 | /** |
72 | * This adds a property descriptor for the Element feature. |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | protected void addElementPropertyDescriptor(Object object) { |
78 | itemPropertyDescriptors.add |
79 | (createItemPropertyDescriptor |
80 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
81 | getResourceLocator(), |
82 | getString("_UI_Tag_element_feature"), |
83 | getString("_UI_PropertyDescriptor_description", "_UI_Tag_element_feature", "_UI_Tag_type"), |
84 | EMOFPackage.Literals.TAG__ELEMENT, |
85 | true, |
86 | false, |
87 | true, |
88 | null, |
89 | null, |
90 | null)); |
91 | } |
92 | |
93 | /** |
94 | * This adds a property descriptor for the Name feature. |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | protected void addNamePropertyDescriptor(Object object) { |
100 | itemPropertyDescriptors.add |
101 | (createItemPropertyDescriptor |
102 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
103 | getResourceLocator(), |
104 | getString("_UI_Tag_name_feature"), |
105 | getString("_UI_PropertyDescriptor_description", "_UI_Tag_name_feature", "_UI_Tag_type"), |
106 | EMOFPackage.Literals.TAG__NAME, |
107 | true, |
108 | false, |
109 | false, |
110 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
111 | null, |
112 | null)); |
113 | } |
114 | |
115 | /** |
116 | * This adds a property descriptor for the Value feature. |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | protected void addValuePropertyDescriptor(Object object) { |
122 | itemPropertyDescriptors.add |
123 | (createItemPropertyDescriptor |
124 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
125 | getResourceLocator(), |
126 | getString("_UI_Tag_value_feature"), |
127 | getString("_UI_PropertyDescriptor_description", "_UI_Tag_value_feature", "_UI_Tag_type"), |
128 | EMOFPackage.Literals.TAG__VALUE, |
129 | true, |
130 | false, |
131 | false, |
132 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
133 | null, |
134 | null)); |
135 | } |
136 | |
137 | /** |
138 | * This returns Tag.gif. |
139 | * <!-- begin-user-doc --> |
140 | * <!-- end-user-doc --> |
141 | * @generated |
142 | */ |
143 | @Override |
144 | public Object getImage(Object object) { |
145 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Tag")); |
146 | } |
147 | |
148 | /** |
149 | * This returns the label text for the adapted class. |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | @Override |
155 | public String getText(Object object) { |
156 | String label = ((Tag)object).getName(); |
157 | return label == null || label.length() == 0 ? |
158 | getString("_UI_Tag_type") : |
159 | getString("_UI_Tag_type") + " " + label; |
160 | } |
161 | |
162 | /** |
163 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
164 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
165 | * <!-- begin-user-doc --> |
166 | * <!-- end-user-doc --> |
167 | * @generated |
168 | */ |
169 | @Override |
170 | public void notifyChanged(Notification notification) { |
171 | updateChildren(notification); |
172 | |
173 | switch (notification.getFeatureID(Tag.class)) { |
174 | case EMOFPackage.TAG__NAME: |
175 | case EMOFPackage.TAG__VALUE: |
176 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
177 | return; |
178 | } |
179 | super.notifyChanged(notification); |
180 | } |
181 | |
182 | /** |
183 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
184 | * that can be created under this object. |
185 | * <!-- begin-user-doc --> |
186 | * <!-- end-user-doc --> |
187 | * @generated |
188 | */ |
189 | @Override |
190 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
191 | super.collectNewChildDescriptors(newChildDescriptors, object); |
192 | } |
193 | |
194 | } |