KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > edit > tree > util > TreeAdapterFactory


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: TreeAdapterFactory.java,v 1.3 2005/06/08 06:17:06 nickb Exp $
16  */

17 package org.eclipse.emf.edit.tree.util;
18
19
20 import org.eclipse.emf.common.notify.Adapter;
21 import org.eclipse.emf.common.notify.Notifier;
22 import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
23 import org.eclipse.emf.ecore.EObject;
24 import org.eclipse.emf.edit.tree.*;
25
26
27 /**
28  * <!-- begin-user-doc -->
29  * The <b>Adapter Factory</b> for the model.
30  * It provides an adapter <code>createXXX</code> method for each class of the model.
31  * <!-- end-user-doc -->
32  * @see org.eclipse.emf.edit.tree.TreePackage
33  * @generated
34  */

35 public class TreeAdapterFactory extends AdapterFactoryImpl
36 {
37
38   /**
39    * The cached model package.
40    * <!-- begin-user-doc -->
41    * <!-- end-user-doc -->
42    * @generated
43    */

44   protected static TreePackage modelPackage;
45
46   /**
47    * Creates an instance of the adapter factory.
48    * <!-- begin-user-doc -->
49    * <!-- end-user-doc -->
50    * @generated
51    */

52   public TreeAdapterFactory()
53   {
54     if (modelPackage == null)
55     {
56       modelPackage = TreePackage.eINSTANCE;
57     }
58   }
59
60   /**
61    * Returns whether this factory is applicable for the type of the object.
62    * <!-- begin-user-doc -->
63    * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
64    * <!-- end-user-doc -->
65    * @return whether this factory is applicable for the type of the object.
66    * @generated
67    */

68   public boolean isFactoryForType(Object JavaDoc object)
69   {
70     if (object == modelPackage)
71     {
72       return true;
73     }
74     if (object instanceof EObject)
75     {
76       return ((EObject)object).eClass().getEPackage() == modelPackage;
77     }
78     return false;
79   }
80
81   /**
82    * The switch the delegates to the <code>createXXX</code> methods.
83    * <!-- begin-user-doc -->
84    * <!-- end-user-doc -->
85    * @generated
86    */

87   protected TreeSwitch modelSwitch =
88     new TreeSwitch()
89     {
90       public Object JavaDoc caseTreeNode(TreeNode object)
91       {
92         return createTreeNodeAdapter();
93       }
94       public Object JavaDoc defaultCase(EObject object)
95       {
96         return createEObjectAdapter();
97       }
98     };
99
100   /**
101    * Creates an adapter for the <code>target</code>.
102    * <!-- begin-user-doc -->
103    * <!-- end-user-doc -->
104    * @param target the object to adapt.
105    * @return the adapter for the <code>target</code>.
106    * @generated
107    */

108   public Adapter createAdapter(Notifier target)
109   {
110     return (Adapter)modelSwitch.doSwitch((EObject)target);
111   }
112
113
114   /**
115    * Creates a new adapter for an object of class '{@link org.eclipse.emf.edit.tree.TreeNode <em>Node</em>}'.
116    * <!-- begin-user-doc -->
117    * This default implementation returns null so that we can easily ignore cases;
118    * it's useful to ignore a case when inheritance will catch all the cases anyway.
119    * <!-- end-user-doc -->
120    * @return the new adapter.
121    * @see org.eclipse.emf.edit.tree.TreeNode
122    * @generated
123    */

124   public Adapter createTreeNodeAdapter()
125   {
126     return null;
127   }
128
129   /**
130    * Creates a new adapter for the default case.
131    * <!-- begin-user-doc -->
132    * This default implementation returns null.
133    * <!-- end-user-doc -->
134    * @return the new adapter.
135    * @generated
136    */

137   public Adapter createEObjectAdapter()
138   {
139     return null;
140   }
141
142 } //TreeAdapterFactory
143
Popular Tags