| /** |
| * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others. |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Eugen Neufeld - initial API and implementation |
| * Lucas Koehler - extension for EnumComboViewerRenderer_PTest |
| */ |
| package org.eclipse.emf.ecp.view.core.swt.test.model.impl; |
| |
| import javax.xml.datatype.XMLGregorianCalendar; |
| |
| import org.eclipse.emf.ecore.EAttribute; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EDataType; |
| import org.eclipse.emf.ecore.EEnum; |
| import org.eclipse.emf.ecore.EPackage; |
| import org.eclipse.emf.ecore.impl.EPackageImpl; |
| import org.eclipse.emf.ecp.view.core.swt.test.model.SimpleTestObject; |
| import org.eclipse.emf.ecp.view.core.swt.test.model.TestEnum; |
| import org.eclipse.emf.ecp.view.core.swt.test.model.TestFactory; |
| import org.eclipse.emf.ecp.view.core.swt.test.model.TestPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Package</b>. |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public class TestPackageImpl extends EPackageImpl implements TestPackage { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| private EClass simpleTestObjectEClass = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| private EEnum testEnumEEnum = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| private EDataType xmlDateEDataType = null; |
| |
| /** |
| * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry |
| * EPackage.Registry} by the package |
| * package URI value. |
| * <p> |
| * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also |
| * performs initialization of the package, or returns the registered package, if one already exists. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see org.eclipse.emf.ecore.EPackage.Registry |
| * @see org.eclipse.emf.ecp.view.core.swt.test.model.TestPackage#eNS_URI |
| * @see #init() |
| * @generated |
| */ |
| private TestPackageImpl() { |
| super(eNS_URI, TestFactory.eINSTANCE); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| private static boolean isInited = false; |
| |
| /** |
| * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. |
| * |
| * <p> |
| * This method is used to initialize {@link TestPackage#eINSTANCE} when that field is accessed. Clients should not |
| * invoke it directly. Instead, they should simply access that field to obtain the package. <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #eNS_URI |
| * @see #createPackageContents() |
| * @see #initializePackageContents() |
| * @generated |
| */ |
| public static TestPackage init() { |
| if (isInited) { |
| return (TestPackage) EPackage.Registry.INSTANCE.getEPackage(TestPackage.eNS_URI); |
| } |
| |
| // Obtain or create and register package |
| final TestPackageImpl theTestPackage = (TestPackageImpl) (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof TestPackageImpl ? EPackage.Registry.INSTANCE |
| .get(eNS_URI) : new TestPackageImpl()); |
| |
| isInited = true; |
| |
| // Create package meta-data objects |
| theTestPackage.createPackageContents(); |
| |
| // Initialize created meta-data |
| theTestPackage.initializePackageContents(); |
| |
| // Mark meta-data to indicate it can't be changed |
| theTestPackage.freeze(); |
| |
| // Update the registry and return the package |
| EPackage.Registry.INSTANCE.put(TestPackage.eNS_URI, theTestPackage); |
| return theTestPackage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EClass getSimpleTestObject() { |
| return simpleTestObjectEClass; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EAttribute getSimpleTestObject_Date() { |
| return (EAttribute) simpleTestObjectEClass.getEStructuralFeatures().get(0); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EAttribute getSimpleTestObject_XmlDate() { |
| return (EAttribute) simpleTestObjectEClass.getEStructuralFeatures().get(1); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EAttribute getSimpleTestObject_MyEnum() { |
| return (EAttribute) simpleTestObjectEClass.getEStructuralFeatures().get(2); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EEnum getTestEnum() { |
| return testEnumEEnum; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EDataType getXMLDate() { |
| return xmlDateEDataType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public TestFactory getTestFactory() { |
| return (TestFactory) getEFactoryInstance(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| private boolean isCreated = false; |
| |
| /** |
| * Creates the meta-model objects for the package. This method is |
| * guarded to have no affect on any invocation but its first. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void createPackageContents() { |
| if (isCreated) { |
| return; |
| } |
| isCreated = true; |
| |
| // Create classes and their features |
| simpleTestObjectEClass = createEClass(SIMPLE_TEST_OBJECT); |
| createEAttribute(simpleTestObjectEClass, SIMPLE_TEST_OBJECT__DATE); |
| createEAttribute(simpleTestObjectEClass, SIMPLE_TEST_OBJECT__XML_DATE); |
| createEAttribute(simpleTestObjectEClass, SIMPLE_TEST_OBJECT__MY_ENUM); |
| |
| // Create enums |
| testEnumEEnum = createEEnum(TEST_ENUM); |
| |
| // Create data types |
| xmlDateEDataType = createEDataType(XML_DATE); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| private boolean isInitialized = false; |
| |
| /** |
| * Complete the initialization of the package and its meta-model. This |
| * method is guarded to have no affect on any invocation but its first. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void initializePackageContents() { |
| if (isInitialized) { |
| return; |
| } |
| isInitialized = true; |
| |
| // Initialize package |
| setName(eNAME); |
| setNsPrefix(eNS_PREFIX); |
| setNsURI(eNS_URI); |
| |
| // Create type parameters |
| |
| // Set bounds for type parameters |
| |
| // Add supertypes to classes |
| |
| // Initialize classes, features, and operations; add parameters |
| initEClass(simpleTestObjectEClass, SimpleTestObject.class, |
| "SimpleTestObject", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| initEAttribute( |
| getSimpleTestObject_Date(), |
| ecorePackage.getEDate(), |
| "date", null, 0, 1, SimpleTestObject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ |
| initEAttribute( |
| getSimpleTestObject_XmlDate(), |
| getXMLDate(), |
| "xmlDate", null, 0, 1, SimpleTestObject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ |
| initEAttribute( |
| getSimpleTestObject_MyEnum(), |
| getTestEnum(), |
| "myEnum", null, 0, 1, SimpleTestObject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ |
| |
| // Initialize enums and add enum literals |
| initEEnum(testEnumEEnum, TestEnum.class, "TestEnum"); //$NON-NLS-1$ |
| addEEnumLiteral(testEnumEEnum, TestEnum.A); |
| addEEnumLiteral(testEnumEEnum, TestEnum.B); |
| addEEnumLiteral(testEnumEEnum, TestEnum.C); |
| |
| // Initialize data types |
| initEDataType(xmlDateEDataType, XMLGregorianCalendar.class, |
| "XMLDate", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| |
| // Create resource |
| createResource(eNS_URI); |
| } |
| |
| } // TestPackageImpl |