1 | /** |
2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.context.computed_usage.provider; |
7 | |
8 | |
9 | import de.uka.ipd.sdq.context.computed_usage.ComputedUsagePackage; |
10 | import de.uka.ipd.sdq.context.computed_usage.LoopIteration; |
11 | |
12 | import de.uka.ipd.sdq.pcm.core.CoreFactory; |
13 | import de.uka.ipd.sdq.stoex.StoexFactory; |
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.ecore.EStructuralFeature; |
24 | |
25 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
26 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
27 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
28 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
29 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
30 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
31 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
32 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
33 | import org.eclipse.emf.edit.provider.ViewerNotification; |
34 | |
35 | /** |
36 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.context.computed_usage.LoopIteration} object. |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @generated |
40 | */ |
41 | public class LoopIterationItemProvider |
42 | extends ItemProviderAdapter |
43 | implements |
44 | IEditingDomainItemProvider, |
45 | IStructuredItemContentProvider, |
46 | ITreeItemContentProvider, |
47 | IItemLabelProvider, |
48 | IItemPropertySource { |
49 | /** |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @generated |
53 | */ |
54 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
55 | |
56 | /** |
57 | * This constructs an instance from a factory and a notifier. |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @generated |
61 | */ |
62 | public LoopIterationItemProvider(AdapterFactory adapterFactory) { |
63 | super(adapterFactory); |
64 | } |
65 | |
66 | /** |
67 | * This returns the property descriptors for the adapted class. |
68 | * <!-- begin-user-doc --> |
69 | * <!-- end-user-doc --> |
70 | * @generated |
71 | */ |
72 | @Override |
73 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
74 | if (itemPropertyDescriptors == null) { |
75 | super.getPropertyDescriptors(object); |
76 | |
77 | addLoopaction_LoopIterationPropertyDescriptor(object); |
78 | } |
79 | return itemPropertyDescriptors; |
80 | } |
81 | |
82 | /** |
83 | * This adds a property descriptor for the Loopaction Loop Iteration feature. |
84 | * <!-- begin-user-doc --> |
85 | * <!-- end-user-doc --> |
86 | * @generated |
87 | */ |
88 | protected void addLoopaction_LoopIterationPropertyDescriptor(Object object) { |
89 | itemPropertyDescriptors.add |
90 | (createItemPropertyDescriptor |
91 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
92 | getResourceLocator(), |
93 | getString("_UI_LoopIteration_loopaction_LoopIteration_feature"), |
94 | getString("_UI_PropertyDescriptor_description", "_UI_LoopIteration_loopaction_LoopIteration_feature", "_UI_LoopIteration_type"), |
95 | ComputedUsagePackage.Literals.LOOP_ITERATION__LOOPACTION_LOOP_ITERATION, |
96 | true, |
97 | false, |
98 | true, |
99 | null, |
100 | null, |
101 | null)); |
102 | } |
103 | |
104 | /** |
105 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
106 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
107 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
108 | * <!-- begin-user-doc --> |
109 | * <!-- end-user-doc --> |
110 | * @generated |
111 | */ |
112 | @Override |
113 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
114 | if (childrenFeatures == null) { |
115 | super.getChildrenFeatures(object); |
116 | childrenFeatures.add(ComputedUsagePackage.Literals.LOOP_ITERATION__SPECIFICATION_LOOP_ITERATION); |
117 | } |
118 | return childrenFeatures; |
119 | } |
120 | |
121 | /** |
122 | * <!-- begin-user-doc --> |
123 | * <!-- end-user-doc --> |
124 | * @generated |
125 | */ |
126 | @Override |
127 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
128 | // Check the type of the specified child object and return the proper feature to use for |
129 | // adding (see {@link AddCommand}) it as a child. |
130 | |
131 | return super.getChildFeature(object, child); |
132 | } |
133 | |
134 | /** |
135 | * This returns LoopIteration.gif. |
136 | * <!-- begin-user-doc --> |
137 | * <!-- end-user-doc --> |
138 | * @generated |
139 | */ |
140 | @Override |
141 | public Object getImage(Object object) { |
142 | return overlayImage(object, getResourceLocator().getImage("full/obj16/LoopIteration")); |
143 | } |
144 | |
145 | /** |
146 | * This returns the label text for the adapted class. |
147 | * <!-- begin-user-doc --> |
148 | * <!-- end-user-doc --> |
149 | * @generated |
150 | */ |
151 | @Override |
152 | public String getText(Object object) { |
153 | return getString("_UI_LoopIteration_type"); |
154 | } |
155 | |
156 | /** |
157 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
158 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
159 | * <!-- begin-user-doc --> |
160 | * <!-- end-user-doc --> |
161 | * @generated |
162 | */ |
163 | @Override |
164 | public void notifyChanged(Notification notification) { |
165 | updateChildren(notification); |
166 | |
167 | switch (notification.getFeatureID(LoopIteration.class)) { |
168 | case ComputedUsagePackage.LOOP_ITERATION__SPECIFICATION_LOOP_ITERATION: |
169 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
170 | return; |
171 | } |
172 | super.notifyChanged(notification); |
173 | } |
174 | |
175 | /** |
176 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
177 | * that can be created under this object. |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | @Override |
183 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
184 | super.collectNewChildDescriptors(newChildDescriptors, object); |
185 | |
186 | newChildDescriptors.add |
187 | (createChildParameter |
188 | (ComputedUsagePackage.Literals.LOOP_ITERATION__SPECIFICATION_LOOP_ITERATION, |
189 | CoreFactory.eINSTANCE.createPCMRandomVariable())); |
190 | } |
191 | |
192 | /** |
193 | * Return the resource locator for this item provider's resources. |
194 | * <!-- begin-user-doc --> |
195 | * <!-- end-user-doc --> |
196 | * @generated |
197 | */ |
198 | @Override |
199 | public ResourceLocator getResourceLocator() { |
200 | return ContextEditPlugin.INSTANCE; |
201 | } |
202 | |
203 | } |