| 1 |
/** |
| 2 |
* Copyright (c) 2002-2010 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v2.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v20.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* IBM - Initial API and implementation |
| 10 |
*/ |
| 11 |
package org.eclipse.emf.edit.tree.impl; |
| 12 |
|
| 13 |
|
| 14 |
import com.google.gwt.user.client.rpc.IsSerializable; |
| 15 |
import org.eclipse.emf.common.util.Reflect; |
| 16 |
import org.eclipse.emf.ecore.EClass; |
| 17 |
import org.eclipse.emf.ecore.EPackage; |
| 18 |
import org.eclipse.emf.ecore.EReference; |
| 19 |
import org.eclipse.emf.ecore.EcorePackage; |
| 20 |
import org.eclipse.emf.ecore.impl.EPackageImpl; |
| 21 |
import org.eclipse.emf.edit.tree.TreeFactory; |
| 22 |
import org.eclipse.emf.edit.tree.TreeNode; |
| 23 |
import org.eclipse.emf.edit.tree.TreePackage; |
| 24 |
|
| 25 |
|
| 26 |
/** |
| 27 |
* <!-- begin-user-doc --> |
| 28 |
* An implementation of the model <b>Package</b>. |
| 29 |
* <!-- end-user-doc --> |
| 30 |
* @generated |
| 31 |
*/ |
| 32 |
public class TreePackageImpl extends EPackageImpl implements TreePackage |
| 33 |
{ |
| 34 |
/** |
| 35 |
* <!-- begin-user-doc --> |
| 36 |
* <!-- end-user-doc --> |
| 37 |
* @generated |
| 38 |
*/ |
| 39 |
private EClass treeNodeEClass = null; |
| 40 |
|
| 41 |
/** |
| 42 |
* Creates an instance of the model <b>Package</b>, registered with |
| 43 |
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package |
| 44 |
* package URI value. |
| 45 |
* <p>Note: the correct way to create the package is via the static |
| 46 |
* factory method {@link #init init()}, which also performs |
| 47 |
* initialization of the package, or returns the registered package, |
| 48 |
* if one already exists. |
| 49 |
* <!-- begin-user-doc --> |
| 50 |
* <!-- end-user-doc --> |
| 51 |
* @see org.eclipse.emf.ecore.EPackage.Registry |
| 52 |
* @see org.eclipse.emf.edit.tree.TreePackage#eNS_URI |
| 53 |
* @see #init() |
| 54 |
* @generated |
| 55 |
*/ |
| 56 |
private TreePackageImpl() |
| 57 |
{ |
| 58 |
super(eNS_URI, TreeFactory.eINSTANCE); |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* <!-- begin-user-doc --> |
| 63 |
* <!-- end-user-doc --> |
| 64 |
* @generated |
| 65 |
*/ |
| 66 |
private static boolean isInited = false; |
| 67 |
|
| 68 |
/** |
| 69 |
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. |
| 70 |
* |
| 71 |
* <p>This method is used to initialize {@link TreePackage#eINSTANCE} when that field is accessed. |
| 72 |
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. |
| 73 |
* <!-- begin-user-doc --> |
| 74 |
* <!-- end-user-doc --> |
| 75 |
* @see #eNS_URI |
| 76 |
* @see #createPackageContents() |
| 77 |
* @see #initializePackageContents() |
| 78 |
* @generated |
| 79 |
*/ |
| 80 |
public static TreePackage init() |
| 81 |
{ |
| 82 |
if (isInited) return (TreePackage)EPackage.Registry.INSTANCE.getEPackage(TreePackage.eNS_URI); |
| 83 |
|
| 84 |
initializeRegistryHelpers(); |
| 85 |
|
| 86 |
// Obtain or create and register package |
| 87 |
Object registeredTreePackage = EPackage.Registry.INSTANCE.get(eNS_URI); |
| 88 |
TreePackageImpl theTreePackage = registeredTreePackage instanceof TreePackageImpl ? (TreePackageImpl)registeredTreePackage : new TreePackageImpl(); |
| 89 |
|
| 90 |
isInited = true; |
| 91 |
|
| 92 |
// Initialize simple dependencies |
| 93 |
EcorePackage.eINSTANCE.eClass(); |
| 94 |
|
| 95 |
// Create package meta-data objects |
| 96 |
theTreePackage.createPackageContents(); |
| 97 |
|
| 98 |
// Initialize created meta-data |
| 99 |
theTreePackage.initializePackageContents(); |
| 100 |
|
| 101 |
// Mark meta-data to indicate it can't be changed |
| 102 |
theTreePackage.freeze(); |
| 103 |
|
| 104 |
// Update the registry and return the package |
| 105 |
EPackage.Registry.INSTANCE.put(TreePackage.eNS_URI, theTreePackage); |
| 106 |
return theTreePackage; |
| 107 |
} |
| 108 |
|
| 109 |
/** |
| 110 |
* <!-- begin-user-doc --> |
| 111 |
* <!-- end-user-doc --> |
| 112 |
* @generated |
| 113 |
*/ |
| 114 |
public static void initializeRegistryHelpers() |
| 115 |
{ |
| 116 |
Reflect.register |
| 117 |
(TreeNode.class, |
| 118 |
new Reflect.Helper() |
| 119 |
{ |
| 120 |
public boolean isInstance(Object instance) |
| 121 |
{ |
| 122 |
return instance instanceof TreeNode; |
| 123 |
} |
| 124 |
|
| 125 |
public Object newArrayInstance(int size) |
| 126 |
{ |
| 127 |
return new TreeNode[size]; |
| 128 |
} |
| 129 |
}); |
| 130 |
} |
| 131 |
|
| 132 |
/** |
| 133 |
* <!-- begin-user-doc --> |
| 134 |
* <!-- end-user-doc --> |
| 135 |
* @generated |
| 136 |
*/ |
| 137 |
public static class WhiteList implements IsSerializable, EBasicWhiteList |
| 138 |
{ |
| 139 |
/** |
| 140 |
* <!-- begin-user-doc --> |
| 141 |
* <!-- end-user-doc --> |
| 142 |
* @generated |
| 143 |
*/ |
| 144 |
protected TreeNode treeNode; |
| 145 |
|
| 146 |
} |
| 147 |
|
| 148 |
/** |
| 149 |
* <!-- begin-user-doc --> |
| 150 |
* <!-- end-user-doc --> |
| 151 |
* @generated |
| 152 |
*/ |
| 153 |
@Override |
| 154 |
public EClass getTreeNode() |
| 155 |
{ |
| 156 |
return treeNodeEClass; |
| 157 |
} |
| 158 |
|
| 159 |
/** |
| 160 |
* <!-- begin-user-doc --> |
| 161 |
* <!-- end-user-doc --> |
| 162 |
* @generated |
| 163 |
*/ |
| 164 |
@Override |
| 165 |
public EReference getTreeNode_Parent() |
| 166 |
{ |
| 167 |
return (EReference)treeNodeEClass.getEStructuralFeatures().get(0); |
| 168 |
} |
| 169 |
|
| 170 |
/** |
| 171 |
* <!-- begin-user-doc --> |
| 172 |
* <!-- end-user-doc --> |
| 173 |
* @generated |
| 174 |
*/ |
| 175 |
@Override |
| 176 |
public EReference getTreeNode_Children() |
| 177 |
{ |
| 178 |
return (EReference)treeNodeEClass.getEStructuralFeatures().get(1); |
| 179 |
} |
| 180 |
|
| 181 |
/** |
| 182 |
* <!-- begin-user-doc --> |
| 183 |
* <!-- end-user-doc --> |
| 184 |
* @generated |
| 185 |
*/ |
| 186 |
@Override |
| 187 |
public EReference getTreeNode_Data() |
| 188 |
{ |
| 189 |
return (EReference)treeNodeEClass.getEStructuralFeatures().get(2); |
| 190 |
} |
| 191 |
|
| 192 |
/** |
| 193 |
* <!-- begin-user-doc --> |
| 194 |
* <!-- end-user-doc --> |
| 195 |
* @generated |
| 196 |
*/ |
| 197 |
@Override |
| 198 |
public TreeFactory getTreeFactory() |
| 199 |
{ |
| 200 |
return (TreeFactory)getEFactoryInstance(); |
| 201 |
} |
| 202 |
|
| 203 |
/** |
| 204 |
* <!-- begin-user-doc --> |
| 205 |
* <!-- end-user-doc --> |
| 206 |
* @generated |
| 207 |
*/ |
| 208 |
private boolean isCreated = false; |
| 209 |
|
| 210 |
/** |
| 211 |
* Creates the meta-model objects for the package. This method is |
| 212 |
* guarded to have no affect on any invocation but its first. |
| 213 |
* <!-- begin-user-doc --> |
| 214 |
* <!-- end-user-doc --> |
| 215 |
* @generated |
| 216 |
*/ |
| 217 |
public void createPackageContents() |
| 218 |
{ |
| 219 |
if (isCreated) return; |
| 220 |
isCreated = true; |
| 221 |
|
| 222 |
// Create classes and their features |
| 223 |
treeNodeEClass = createEClass(TREE_NODE); |
| 224 |
createEReference(treeNodeEClass, TREE_NODE__PARENT); |
| 225 |
createEReference(treeNodeEClass, TREE_NODE__CHILDREN); |
| 226 |
createEReference(treeNodeEClass, TREE_NODE__DATA); |
| 227 |
} |
| 228 |
|
| 229 |
/** |
| 230 |
* <!-- begin-user-doc --> |
| 231 |
* <!-- end-user-doc --> |
| 232 |
* @generated |
| 233 |
*/ |
| 234 |
private boolean isInitialized = false; |
| 235 |
|
| 236 |
/** |
| 237 |
* Complete the initialization of the package and its meta-model. This |
| 238 |
* method is guarded to have no affect on any invocation but its first. |
| 239 |
* <!-- begin-user-doc --> |
| 240 |
* <!-- end-user-doc --> |
| 241 |
* @generated |
| 242 |
*/ |
| 243 |
public void initializePackageContents() |
| 244 |
{ |
| 245 |
if (isInitialized) return; |
| 246 |
isInitialized = true; |
| 247 |
|
| 248 |
// Initialize package |
| 249 |
setName(eNAME); |
| 250 |
setNsPrefix(eNS_PREFIX); |
| 251 |
setNsURI(eNS_URI); |
| 252 |
|
| 253 |
// Obtain other dependent packages |
| 254 |
EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI); |
| 255 |
|
| 256 |
// Create type parameters |
| 257 |
|
| 258 |
// Set bounds for type parameters |
| 259 |
|
| 260 |
// Add supertypes to classes |
| 261 |
|
| 262 |
// Initialize classes and features; add operations and parameters |
| 263 |
initEClass(treeNodeEClass, TreeNode.class, "TreeNode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
| 264 |
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); |
| 265 |
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); |
| 266 |
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); |
| 267 |
|
| 268 |
// Create resource |
| 269 |
createResource(eNS_URI); |
| 270 |
} |
| 271 |
|
| 272 |
} //TreePackageImpl |