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