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.NegativeExpression; |
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.NegativeExpression} object. |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public class NegativeExpressionItemProvider |
35 | extends UnaryItemProvider |
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 NegativeExpressionItemProvider(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.NEGATIVE_EXPRESSION__INNER); |
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 NegativeExpression.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/NegativeExpression")); |
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_NegativeExpression_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(NegativeExpression.class)) { |
138 | case StoexPackage.NEGATIVE_EXPRESSION__INNER: |
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.NEGATIVE_EXPRESSION__INNER, |
159 | StoexFactory.eINSTANCE.createVariable())); |
160 | |
161 | newChildDescriptors.add |
162 | (createChildParameter |
163 | (StoexPackage.Literals.NEGATIVE_EXPRESSION__INNER, |
164 | StoexFactory.eINSTANCE.createProbabilityFunctionLiteral())); |
165 | |
166 | newChildDescriptors.add |
167 | (createChildParameter |
168 | (StoexPackage.Literals.NEGATIVE_EXPRESSION__INNER, |
169 | StoexFactory.eINSTANCE.createParenthesis())); |
170 | |
171 | newChildDescriptors.add |
172 | (createChildParameter |
173 | (StoexPackage.Literals.NEGATIVE_EXPRESSION__INNER, |
174 | StoexFactory.eINSTANCE.createIntLiteral())); |
175 | |
176 | newChildDescriptors.add |
177 | (createChildParameter |
178 | (StoexPackage.Literals.NEGATIVE_EXPRESSION__INNER, |
179 | StoexFactory.eINSTANCE.createDoubleLiteral())); |
180 | |
181 | newChildDescriptors.add |
182 | (createChildParameter |
183 | (StoexPackage.Literals.NEGATIVE_EXPRESSION__INNER, |
184 | StoexFactory.eINSTANCE.createBoolLiteral())); |
185 | |
186 | newChildDescriptors.add |
187 | (createChildParameter |
188 | (StoexPackage.Literals.NEGATIVE_EXPRESSION__INNER, |
189 | StoexFactory.eINSTANCE.createStringLiteral())); |
190 | |
191 | newChildDescriptors.add |
192 | (createChildParameter |
193 | (StoexPackage.Literals.NEGATIVE_EXPRESSION__INNER, |
194 | StoexFactory.eINSTANCE.createNotExpression())); |
195 | |
196 | newChildDescriptors.add |
197 | (createChildParameter |
198 | (StoexPackage.Literals.NEGATIVE_EXPRESSION__INNER, |
199 | StoexFactory.eINSTANCE.createNegativeExpression())); |
200 | |
201 | newChildDescriptors.add |
202 | (createChildParameter |
203 | (StoexPackage.Literals.NEGATIVE_EXPRESSION__INNER, |
204 | StoexFactory.eINSTANCE.createFunctionLiteral())); |
205 | } |
206 | |
207 | } |