1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.core.composition.provider; |
7 | |
8 | |
9 | import de.uka.ipd.sdq.pcm.core.CoreFactory; |
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.ecore.EStructuralFeature; |
16 | import org.eclipse.emf.common.util.ResourceLocator; |
17 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
18 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
19 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
20 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
21 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
22 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
23 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
24 | |
25 | import org.eclipse.emf.edit.provider.ViewerNotification; |
26 | import de.uka.ipd.sdq.pcm.core.composition.AssemblyEventConnector; |
27 | import de.uka.ipd.sdq.pcm.core.composition.CompositionPackage; |
28 | import de.uka.ipd.sdq.pcm.core.composition.provider.ConnectorItemProvider; |
29 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
30 | |
31 | /** |
32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.core.composition.AssemblyEventConnector} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class AssemblyEventConnectorItemProvider |
38 | extends ConnectorItemProvider |
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 AssemblyEventConnectorItemProvider(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 | addSinkRole__AssemblyEventConnectorPropertyDescriptor(object); |
74 | addSourceRole__AssemblyEventConnectorPropertyDescriptor(object); |
75 | addSinkAssemblyContext__AssemblyEventConnectorPropertyDescriptor(object); |
76 | addSourceAssemblyContext__AssemblyEventConnectorPropertyDescriptor(object); |
77 | } |
78 | return itemPropertyDescriptors; |
79 | } |
80 | |
81 | /** |
82 | * This adds a property descriptor for the Sink Role Assembly Event Connector feature. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | protected void addSinkRole__AssemblyEventConnectorPropertyDescriptor(Object object) { |
88 | itemPropertyDescriptors.add |
89 | (createItemPropertyDescriptor |
90 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
91 | getResourceLocator(), |
92 | getString("_UI_AssemblyEventConnector_sinkRole__AssemblyEventConnector_feature"), |
93 | getString("_UI_PropertyDescriptor_description", "_UI_AssemblyEventConnector_sinkRole__AssemblyEventConnector_feature", "_UI_AssemblyEventConnector_type"), |
94 | CompositionPackage.Literals.ASSEMBLY_EVENT_CONNECTOR__SINK_ROLE_ASSEMBLY_EVENT_CONNECTOR, |
95 | true, |
96 | false, |
97 | true, |
98 | null, |
99 | null, |
100 | null)); |
101 | } |
102 | |
103 | /** |
104 | * This adds a property descriptor for the Source Role Assembly Event Connector feature. |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | protected void addSourceRole__AssemblyEventConnectorPropertyDescriptor(Object object) { |
110 | itemPropertyDescriptors.add |
111 | (createItemPropertyDescriptor |
112 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
113 | getResourceLocator(), |
114 | getString("_UI_AssemblyEventConnector_sourceRole__AssemblyEventConnector_feature"), |
115 | getString("_UI_PropertyDescriptor_description", "_UI_AssemblyEventConnector_sourceRole__AssemblyEventConnector_feature", "_UI_AssemblyEventConnector_type"), |
116 | CompositionPackage.Literals.ASSEMBLY_EVENT_CONNECTOR__SOURCE_ROLE_ASSEMBLY_EVENT_CONNECTOR, |
117 | true, |
118 | false, |
119 | true, |
120 | null, |
121 | null, |
122 | null)); |
123 | } |
124 | |
125 | /** |
126 | * This adds a property descriptor for the Sink Assembly Context Assembly Event Connector feature. |
127 | * <!-- begin-user-doc --> |
128 | * <!-- end-user-doc --> |
129 | * @generated |
130 | */ |
131 | protected void addSinkAssemblyContext__AssemblyEventConnectorPropertyDescriptor(Object object) { |
132 | itemPropertyDescriptors.add |
133 | (createItemPropertyDescriptor |
134 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
135 | getResourceLocator(), |
136 | getString("_UI_AssemblyEventConnector_sinkAssemblyContext__AssemblyEventConnector_feature"), |
137 | getString("_UI_PropertyDescriptor_description", "_UI_AssemblyEventConnector_sinkAssemblyContext__AssemblyEventConnector_feature", "_UI_AssemblyEventConnector_type"), |
138 | CompositionPackage.Literals.ASSEMBLY_EVENT_CONNECTOR__SINK_ASSEMBLY_CONTEXT_ASSEMBLY_EVENT_CONNECTOR, |
139 | true, |
140 | false, |
141 | true, |
142 | null, |
143 | null, |
144 | null)); |
145 | } |
146 | |
147 | /** |
148 | * This adds a property descriptor for the Source Assembly Context Assembly Event Connector feature. |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | protected void addSourceAssemblyContext__AssemblyEventConnectorPropertyDescriptor(Object object) { |
154 | itemPropertyDescriptors.add |
155 | (createItemPropertyDescriptor |
156 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
157 | getResourceLocator(), |
158 | getString("_UI_AssemblyEventConnector_sourceAssemblyContext__AssemblyEventConnector_feature"), |
159 | getString("_UI_PropertyDescriptor_description", "_UI_AssemblyEventConnector_sourceAssemblyContext__AssemblyEventConnector_feature", "_UI_AssemblyEventConnector_type"), |
160 | CompositionPackage.Literals.ASSEMBLY_EVENT_CONNECTOR__SOURCE_ASSEMBLY_CONTEXT_ASSEMBLY_EVENT_CONNECTOR, |
161 | true, |
162 | false, |
163 | true, |
164 | null, |
165 | null, |
166 | null)); |
167 | } |
168 | |
169 | /** |
170 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
171 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
172 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
173 | * <!-- begin-user-doc --> |
174 | * <!-- end-user-doc --> |
175 | * @generated |
176 | */ |
177 | @Override |
178 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
179 | if (childrenFeatures == null) { |
180 | super.getChildrenFeatures(object); |
181 | childrenFeatures.add(CompositionPackage.Literals.ASSEMBLY_EVENT_CONNECTOR__FILTER_CONDITION_ASSEMBLY_EVENT_CONNECTOR); |
182 | } |
183 | return childrenFeatures; |
184 | } |
185 | |
186 | /** |
187 | * <!-- begin-user-doc --> |
188 | * <!-- end-user-doc --> |
189 | * @generated |
190 | */ |
191 | @Override |
192 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
193 | // Check the type of the specified child object and return the proper feature to use for |
194 | // adding (see {@link AddCommand}) it as a child. |
195 | |
196 | return super.getChildFeature(object, child); |
197 | } |
198 | |
199 | /** |
200 | * This returns AssemblyEventConnector.gif. |
201 | * <!-- begin-user-doc --> |
202 | * <!-- end-user-doc --> |
203 | * @generated |
204 | */ |
205 | @Override |
206 | public Object getImage(Object object) { |
207 | return overlayImage(object, getResourceLocator().getImage("full/obj16/AssemblyEventConnector")); |
208 | } |
209 | |
210 | /** |
211 | * This returns the label text for the adapted class. |
212 | * <!-- begin-user-doc --> |
213 | * <!-- end-user-doc --> |
214 | * @generated |
215 | */ |
216 | @Override |
217 | public String getText(Object object) { |
218 | String label = ((AssemblyEventConnector)object).getId(); |
219 | return label == null || label.length() == 0 ? |
220 | getString("_UI_AssemblyEventConnector_type") : |
221 | getString("_UI_AssemblyEventConnector_type") + " " + label; |
222 | } |
223 | |
224 | /** |
225 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
226 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
227 | * <!-- begin-user-doc --> |
228 | * <!-- end-user-doc --> |
229 | * @generated |
230 | */ |
231 | @Override |
232 | public void notifyChanged(Notification notification) { |
233 | updateChildren(notification); |
234 | |
235 | switch (notification.getFeatureID(AssemblyEventConnector.class)) { |
236 | case CompositionPackage.ASSEMBLY_EVENT_CONNECTOR__FILTER_CONDITION_ASSEMBLY_EVENT_CONNECTOR: |
237 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
238 | return; |
239 | } |
240 | super.notifyChanged(notification); |
241 | } |
242 | |
243 | /** |
244 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
245 | * that can be created under this object. |
246 | * <!-- begin-user-doc --> |
247 | * <!-- end-user-doc --> |
248 | * @generated |
249 | */ |
250 | @Override |
251 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
252 | super.collectNewChildDescriptors(newChildDescriptors, object); |
253 | |
254 | newChildDescriptors.add |
255 | (createChildParameter |
256 | (CompositionPackage.Literals.ASSEMBLY_EVENT_CONNECTOR__FILTER_CONDITION_ASSEMBLY_EVENT_CONNECTOR, |
257 | CoreFactory.eINSTANCE.createPCMRandomVariable())); |
258 | } |
259 | |
260 | } |