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