3 package org.opendaylight.nemo.tool.eclipse.plugin.editor.util;
5 import org.eclipse.emf.common.notify.Adapter;
6 import org.eclipse.emf.common.notify.Notifier;
8 import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
10 import org.eclipse.emf.ecore.EObject;
12 import org.opendaylight.nemo.tool.eclipse.plugin.editor.*;
15 * <!-- begin-user-doc -->
16 * The <b>Adapter Factory</b> for the model.
17 * It provides an adapter <code>createXXX</code> method for each class of the model.
18 * <!-- end-user-doc -->
19 * @see org.opendaylight.nemo.tool.eclipse.plugin.editor.EditorPackage
22 public class EditorAdapterFactory extends AdapterFactoryImpl
25 * The cached model package.
26 * <!-- begin-user-doc -->
27 * <!-- end-user-doc -->
30 protected static EditorPackage modelPackage;
33 * Creates an instance of the adapter factory.
34 * <!-- begin-user-doc -->
35 * <!-- end-user-doc -->
38 public EditorAdapterFactory()
40 if (modelPackage == null)
42 modelPackage = EditorPackage.eINSTANCE;
47 * Returns whether this factory is applicable for the type of the object.
48 * <!-- begin-user-doc -->
49 * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
50 * <!-- end-user-doc -->
51 * @return whether this factory is applicable for the type of the object.
55 public boolean isFactoryForType(Object object)
57 if (object == modelPackage)
61 if (object instanceof EObject)
63 return ((EObject)object).eClass().getEPackage() == modelPackage;
69 * The switch that delegates to the <code>createXXX</code> methods.
70 * <!-- begin-user-doc -->
71 * <!-- end-user-doc -->
74 protected EditorSwitch<Adapter> modelSwitch =
75 new EditorSwitch<Adapter>()
78 public Adapter caseModel(Model object)
80 return createModelAdapter();
83 public Adapter caseSentence(Sentence object)
85 return createSentenceAdapter();
88 public Adapter caseNode(Node object)
90 return createNodeAdapter();
93 public Adapter caseNodeModel(NodeModel object)
95 return createNodeModelAdapter();
98 public Adapter caseNodeOperating(NodeOperating object)
100 return createNodeOperatingAdapter();
103 public Adapter caseConnection(Connection object)
105 return createConnectionAdapter();
108 public Adapter caseConnectionUpdate(ConnectionUpdate object)
110 return createConnectionUpdateAdapter();
113 public Adapter caseFlow(Flow object)
115 return createFlowAdapter();
118 public Adapter caseFlowUpdate(FlowUpdate object)
120 return createFlowUpdateAdapter();
123 public Adapter caseOperation(Operation object)
125 return createOperationAdapter();
128 public Adapter defaultCase(EObject object)
130 return createEObjectAdapter();
135 * Creates an adapter for the <code>target</code>.
136 * <!-- begin-user-doc -->
137 * <!-- end-user-doc -->
138 * @param target the object to adapt.
139 * @return the adapter for the <code>target</code>.
143 public Adapter createAdapter(Notifier target)
145 return modelSwitch.doSwitch((EObject)target);
150 * Creates a new adapter for an object of class '{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.Model <em>Model</em>}'.
151 * <!-- begin-user-doc -->
152 * This default implementation returns null so that we can easily ignore cases;
153 * it's useful to ignore a case when inheritance will catch all the cases anyway.
154 * <!-- end-user-doc -->
155 * @return the new adapter.
156 * @see org.opendaylight.nemo.tool.eclipse.plugin.editor.Model
159 public Adapter createModelAdapter()
165 * Creates a new adapter for an object of class '{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.Sentence <em>Sentence</em>}'.
166 * <!-- begin-user-doc -->
167 * This default implementation returns null so that we can easily ignore cases;
168 * it's useful to ignore a case when inheritance will catch all the cases anyway.
169 * <!-- end-user-doc -->
170 * @return the new adapter.
171 * @see org.opendaylight.nemo.tool.eclipse.plugin.editor.Sentence
174 public Adapter createSentenceAdapter()
180 * Creates a new adapter for an object of class '{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.Node <em>Node</em>}'.
181 * <!-- begin-user-doc -->
182 * This default implementation returns null so that we can easily ignore cases;
183 * it's useful to ignore a case when inheritance will catch all the cases anyway.
184 * <!-- end-user-doc -->
185 * @return the new adapter.
186 * @see org.opendaylight.nemo.tool.eclipse.plugin.editor.Node
189 public Adapter createNodeAdapter()
195 * Creates a new adapter for an object of class '{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.NodeModel <em>Node Model</em>}'.
196 * <!-- begin-user-doc -->
197 * This default implementation returns null so that we can easily ignore cases;
198 * it's useful to ignore a case when inheritance will catch all the cases anyway.
199 * <!-- end-user-doc -->
200 * @return the new adapter.
201 * @see org.opendaylight.nemo.tool.eclipse.plugin.editor.NodeModel
204 public Adapter createNodeModelAdapter()
210 * Creates a new adapter for an object of class '{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.NodeOperating <em>Node Operating</em>}'.
211 * <!-- begin-user-doc -->
212 * This default implementation returns null so that we can easily ignore cases;
213 * it's useful to ignore a case when inheritance will catch all the cases anyway.
214 * <!-- end-user-doc -->
215 * @return the new adapter.
216 * @see org.opendaylight.nemo.tool.eclipse.plugin.editor.NodeOperating
219 public Adapter createNodeOperatingAdapter()
225 * Creates a new adapter for an object of class '{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.Connection <em>Connection</em>}'.
226 * <!-- begin-user-doc -->
227 * This default implementation returns null so that we can easily ignore cases;
228 * it's useful to ignore a case when inheritance will catch all the cases anyway.
229 * <!-- end-user-doc -->
230 * @return the new adapter.
231 * @see org.opendaylight.nemo.tool.eclipse.plugin.editor.Connection
234 public Adapter createConnectionAdapter()
240 * Creates a new adapter for an object of class '{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.ConnectionUpdate <em>Connection Update</em>}'.
241 * <!-- begin-user-doc -->
242 * This default implementation returns null so that we can easily ignore cases;
243 * it's useful to ignore a case when inheritance will catch all the cases anyway.
244 * <!-- end-user-doc -->
245 * @return the new adapter.
246 * @see org.opendaylight.nemo.tool.eclipse.plugin.editor.ConnectionUpdate
249 public Adapter createConnectionUpdateAdapter()
255 * Creates a new adapter for an object of class '{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.Flow <em>Flow</em>}'.
256 * <!-- begin-user-doc -->
257 * This default implementation returns null so that we can easily ignore cases;
258 * it's useful to ignore a case when inheritance will catch all the cases anyway.
259 * <!-- end-user-doc -->
260 * @return the new adapter.
261 * @see org.opendaylight.nemo.tool.eclipse.plugin.editor.Flow
264 public Adapter createFlowAdapter()
270 * Creates a new adapter for an object of class '{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.FlowUpdate <em>Flow Update</em>}'.
271 * <!-- begin-user-doc -->
272 * This default implementation returns null so that we can easily ignore cases;
273 * it's useful to ignore a case when inheritance will catch all the cases anyway.
274 * <!-- end-user-doc -->
275 * @return the new adapter.
276 * @see org.opendaylight.nemo.tool.eclipse.plugin.editor.FlowUpdate
279 public Adapter createFlowUpdateAdapter()
285 * Creates a new adapter for an object of class '{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.Operation <em>Operation</em>}'.
286 * <!-- begin-user-doc -->
287 * This default implementation returns null so that we can easily ignore cases;
288 * it's useful to ignore a case when inheritance will catch all the cases anyway.
289 * <!-- end-user-doc -->
290 * @return the new adapter.
291 * @see org.opendaylight.nemo.tool.eclipse.plugin.editor.Operation
294 public Adapter createOperationAdapter()
300 * Creates a new adapter for the default case.
301 * <!-- begin-user-doc -->
302 * This default implementation returns null.
303 * <!-- end-user-doc -->
304 * @return the new adapter.
307 public Adapter createEObjectAdapter()
312 } //EditorAdapterFactory