1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.stoex.provider; |
8 | |
9 | |
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.edit.provider.IEditingDomainItemProvider; |
17 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
18 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
19 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
20 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
21 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
22 | import org.eclipse.emf.edit.provider.ViewerNotification; |
23 | |
24 | import de.uka.ipd.sdq.stoex.Parenthesis; |
25 | import de.uka.ipd.sdq.stoex.StoexFactory; |
26 | import de.uka.ipd.sdq.stoex.StoexPackage; |
27 | |
28 | /** |
29 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.stoex.Parenthesis} object. |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public class ParenthesisItemProvider |
35 | extends AtomItemProvider |
36 | implements |
37 | IEditingDomainItemProvider, |
38 | IStructuredItemContentProvider, |
39 | ITreeItemContentProvider, |
40 | IItemLabelProvider, |
41 | IItemPropertySource { |
42 | /** |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @generated |
46 | */ |
47 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
48 | |
49 | /** |
50 | * This constructs an instance from a factory and a notifier. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @generated |
54 | */ |
55 | public ParenthesisItemProvider(AdapterFactory adapterFactory) { |
56 | super(adapterFactory); |
57 | } |
58 | |
59 | /** |
60 | * This returns the property descriptors for the adapted class. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @generated |
64 | */ |
65 | @Override |
66 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
67 | if (itemPropertyDescriptors == null) { |
68 | super.getPropertyDescriptors(object); |
69 | |
70 | } |
71 | return itemPropertyDescriptors; |
72 | } |
73 | |
74 | /** |
75 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
76 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
77 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | @Override |
83 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
84 | if (childrenFeatures == null) { |
85 | super.getChildrenFeatures(object); |
86 | childrenFeatures.add(StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION); |
87 | } |
88 | return childrenFeatures; |
89 | } |
90 | |
91 | /** |
92 | * <!-- begin-user-doc --> |
93 | * <!-- end-user-doc --> |
94 | * @generated |
95 | */ |
96 | @Override |
97 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
98 | // Check the type of the specified child object and return the proper feature to use for |
99 | // adding (see {@link AddCommand}) it as a child. |
100 | |
101 | return super.getChildFeature(object, child); |
102 | } |
103 | |
104 | /** |
105 | * This returns Parenthesis.gif. |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | @Override |
111 | public Object getImage(Object object) { |
112 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Parenthesis")); |
113 | } |
114 | |
115 | /** |
116 | * This returns the label text for the adapted class. |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | @Override |
122 | public String getText(Object object) { |
123 | return getString("_UI_Parenthesis_type"); |
124 | } |
125 | |
126 | /** |
127 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
128 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
129 | * <!-- begin-user-doc --> |
130 | * <!-- end-user-doc --> |
131 | * @generated |
132 | */ |
133 | @Override |
134 | public void notifyChanged(Notification notification) { |
135 | updateChildren(notification); |
136 | |
137 | switch (notification.getFeatureID(Parenthesis.class)) { |
138 | case StoexPackage.PARENTHESIS__INNER_EXPRESSION: |
139 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
140 | return; |
141 | } |
142 | super.notifyChanged(notification); |
143 | } |
144 | |
145 | /** |
146 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
147 | * that can be created under this object. |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | @Override |
153 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
154 | super.collectNewChildDescriptors(newChildDescriptors, object); |
155 | |
156 | newChildDescriptors.add |
157 | (createChildParameter |
158 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
159 | StoexFactory.eINSTANCE.createVariable())); |
160 | |
161 | newChildDescriptors.add |
162 | (createChildParameter |
163 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
164 | StoexFactory.eINSTANCE.createTermExpression())); |
165 | |
166 | newChildDescriptors.add |
167 | (createChildParameter |
168 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
169 | StoexFactory.eINSTANCE.createProductExpression())); |
170 | |
171 | newChildDescriptors.add |
172 | (createChildParameter |
173 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
174 | StoexFactory.eINSTANCE.createProbabilityFunctionLiteral())); |
175 | |
176 | newChildDescriptors.add |
177 | (createChildParameter |
178 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
179 | StoexFactory.eINSTANCE.createParenthesis())); |
180 | |
181 | newChildDescriptors.add |
182 | (createChildParameter |
183 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
184 | StoexFactory.eINSTANCE.createIntLiteral())); |
185 | |
186 | newChildDescriptors.add |
187 | (createChildParameter |
188 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
189 | StoexFactory.eINSTANCE.createDoubleLiteral())); |
190 | |
191 | newChildDescriptors.add |
192 | (createChildParameter |
193 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
194 | StoexFactory.eINSTANCE.createCompareExpression())); |
195 | |
196 | newChildDescriptors.add |
197 | (createChildParameter |
198 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
199 | StoexFactory.eINSTANCE.createBoolLiteral())); |
200 | |
201 | newChildDescriptors.add |
202 | (createChildParameter |
203 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
204 | StoexFactory.eINSTANCE.createStringLiteral())); |
205 | |
206 | newChildDescriptors.add |
207 | (createChildParameter |
208 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
209 | StoexFactory.eINSTANCE.createPowerExpression())); |
210 | |
211 | newChildDescriptors.add |
212 | (createChildParameter |
213 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
214 | StoexFactory.eINSTANCE.createBooleanOperatorExpression())); |
215 | |
216 | newChildDescriptors.add |
217 | (createChildParameter |
218 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
219 | StoexFactory.eINSTANCE.createNotExpression())); |
220 | |
221 | newChildDescriptors.add |
222 | (createChildParameter |
223 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
224 | StoexFactory.eINSTANCE.createNegativeExpression())); |
225 | |
226 | newChildDescriptors.add |
227 | (createChildParameter |
228 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
229 | StoexFactory.eINSTANCE.createFunctionLiteral())); |
230 | |
231 | newChildDescriptors.add |
232 | (createChildParameter |
233 | (StoexPackage.Literals.PARENTHESIS__INNER_EXPRESSION, |
234 | StoexFactory.eINSTANCE.createIfElseExpression())); |
235 | } |
236 | |
237 | } |