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