KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > edit > tree > impl > TreePackageImpl


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: TreePackageImpl.java,v 1.7 2005/06/08 06:17:06 nickb Exp $
16  */

17 package org.eclipse.emf.edit.tree.impl;
18
19
20 import org.eclipse.emf.ecore.EClass;
21 import org.eclipse.emf.ecore.EPackage;
22 import org.eclipse.emf.ecore.EReference;
23 import org.eclipse.emf.ecore.EcorePackage;
24 import org.eclipse.emf.ecore.impl.EPackageImpl;
25 import org.eclipse.emf.ecore.impl.EcorePackageImpl;
26 import org.eclipse.emf.edit.tree.TreeFactory;
27 import org.eclipse.emf.edit.tree.TreeNode;
28 import org.eclipse.emf.edit.tree.TreePackage;
29
30
31 /**
32  * <!-- begin-user-doc -->
33  * An implementation of the model <b>Package</b>.
34  * <!-- end-user-doc -->
35  * @generated
36  */

37 public class TreePackageImpl extends EPackageImpl implements TreePackage
38 {
39   /**
40    * <!-- begin-user-doc -->
41    * <!-- end-user-doc -->
42    * @generated
43    */

44   private EClass treeNodeEClass = null;
45
46   /**
47    * Creates an instance of the model <b>Package</b>, registered with
48    * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
49    * package URI value.
50    * <p>Note: the correct way to create the package is via the static
51    * factory method {@link #init init()}, which also performs
52    * initialization of the package, or returns the registered package,
53    * if one already exists.
54    * <!-- begin-user-doc -->
55    * <!-- end-user-doc -->
56    * @see org.eclipse.emf.ecore.EPackage.Registry
57    * @see org.eclipse.emf.edit.tree.TreePackage#eNS_URI
58    * @see #init()
59    * @generated
60    */

61   private TreePackageImpl()
62   {
63     super(eNS_URI, TreeFactory.eINSTANCE);
64   }
65
66   /**
67    * <!-- begin-user-doc -->
68    * <!-- end-user-doc -->
69    * @generated
70    */

71   private static boolean isInited = false;
72
73   /**
74    * Creates, registers, and initializes the <b>Package</b> for this
75    * model, and for any others upon which it depends. Simple
76    * dependencies are satisfied by calling this method on all
77    * dependent packages before doing anything else. This method drives
78    * initialization for interdependent packages directly, in parallel
79    * with this package, itself.
80    * <p>Of this package and its interdependencies, all packages which
81    * have not yet been registered by their URI values are first created
82    * and registered. The packages are then initialized in two steps:
83    * meta-model objects for all of the packages are created before any
84    * are initialized, since one package's meta-model objects may refer to
85    * those of another.
86    * <p>Invocation of this method will not affect any packages that have
87    * already been initialized.
88    * <!-- begin-user-doc -->
89    * <!-- end-user-doc -->
90    * @see #eNS_URI
91    * @see #createPackageContents()
92    * @see #initializePackageContents()
93    * @generated
94    */

95   public static TreePackage init()
96   {
97     if (isInited) return (TreePackage)EPackage.Registry.INSTANCE.getEPackage(TreePackage.eNS_URI);
98
99     // Obtain or create and register package
100
TreePackageImpl theTreePackage = (TreePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof TreePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new TreePackageImpl());
101
102     isInited = true;
103
104     // Initialize simple dependencies
105
EcorePackageImpl.init();
106
107     // Create package meta-data objects
108
theTreePackage.createPackageContents();
109
110     // Initialize created meta-data
111
theTreePackage.initializePackageContents();
112
113     // Mark meta-data to indicate it can't be changed
114
theTreePackage.freeze();
115
116     return theTreePackage;
117   }
118
119   /**
120    * <!-- begin-user-doc -->
121    * <!-- end-user-doc -->
122    * @generated
123    */

124   public EClass getTreeNode()
125   {
126     return treeNodeEClass;
127   }
128
129   /**
130    * <!-- begin-user-doc -->
131    * <!-- end-user-doc -->
132    * @generated
133    */

134   public EReference getTreeNode_Parent()
135   {
136     return (EReference)treeNodeEClass.getEStructuralFeatures().get(0);
137   }
138
139   /**
140    * <!-- begin-user-doc -->
141    * <!-- end-user-doc -->
142    * @generated
143    */

144   public EReference getTreeNode_Children()
145   {
146     return (EReference)treeNodeEClass.getEStructuralFeatures().get(1);
147   }
148
149   /**
150    * <!-- begin-user-doc -->
151    * <!-- end-user-doc -->
152    * @generated
153    */

154   public EReference getTreeNode_Data()
155   {
156     return (EReference)treeNodeEClass.getEStructuralFeatures().get(2);
157   }
158
159   /**
160    * <!-- begin-user-doc -->
161    * <!-- end-user-doc -->
162    * @generated
163    */

164   public TreeFactory getTreeFactory()
165   {
166     return (TreeFactory)getEFactoryInstance();
167   }
168
169   /**
170    * <!-- begin-user-doc -->
171    * <!-- end-user-doc -->
172    * @generated
173    */

174   private boolean isCreated = false;
175  
176   /**
177    * Creates the meta-model objects for the package. This method is
178    * guarded to have no affect on any invocation but its first.
179    * <!-- begin-user-doc -->
180    * <!-- end-user-doc -->
181    * @generated
182    */

183   public void createPackageContents()
184   {
185     if (isCreated) return;
186     isCreated = true;
187
188     // Create classes and their features
189
treeNodeEClass = createEClass(TREE_NODE);
190     createEReference(treeNodeEClass, TREE_NODE__PARENT);
191     createEReference(treeNodeEClass, TREE_NODE__CHILDREN);
192     createEReference(treeNodeEClass, TREE_NODE__DATA);
193   }
194
195   /**
196    * <!-- begin-user-doc -->
197    * <!-- end-user-doc -->
198    * @generated
199    */

200   private boolean isInitialized = false;
201
202   /**
203    * Complete the initialization of the package and its meta-model. This
204    * method is guarded to have no affect on any invocation but its first.
205    * <!-- begin-user-doc -->
206    * <!-- end-user-doc -->
207    * @generated
208    */

209   public void initializePackageContents()
210   {
211     if (isInitialized) return;
212     isInitialized = true;
213
214     // Initialize package
215
setName(eNAME);
216     setNsPrefix(eNS_PREFIX);
217     setNsURI(eNS_URI);
218
219     // Obtain other dependent packages
220
EcorePackageImpl theEcorePackage = (EcorePackageImpl)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
221
222     // Add supertypes to classes
223

224     // Initialize classes and features; add operations and parameters
225
initEClass(treeNodeEClass, TreeNode.class, "TreeNode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
226     initEReference(getTreeNode_Parent(), this.getTreeNode(), this.getTreeNode_Children(), "parent", null, 0, 1, TreeNode.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
227     initEReference(getTreeNode_Children(), this.getTreeNode(), this.getTreeNode_Parent(), "children", null, 0, -1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
228     initEReference(getTreeNode_Data(), theEcorePackage.getEObject(), null, "data", null, 1, 1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
229
230     // Create resource
231
createResource(eNS_URI);
232   }
233
234 } //TreePackageImpl
235
Popular Tags