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