1 /**
2  * Copyright (c) 2008, 2015 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *      IBM Corporation - initial API and implementation
13  */
14 package org.eclipse.e4.ui.model.application.descriptor.basic.impl;
15 
16 import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory;
17 import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor;
18 import org.eclipse.emf.ecore.EClass;
19 import org.eclipse.emf.ecore.EObject;
20 import org.eclipse.emf.ecore.EPackage;
21 import org.eclipse.emf.ecore.impl.EFactoryImpl;
22 import org.eclipse.emf.ecore.plugin.EcorePlugin;
23 
24 /**
25  * <!-- begin-user-doc -->
26  * An implementation of the model <b>Factory</b>.
27  * <!-- end-user-doc -->
28  * @generated
29  */
30 public class BasicFactoryImpl extends EFactoryImpl implements MBasicFactory {
31 	/**
32 	 * The singleton instance of the factory.
33 	 * <!-- begin-user-doc -->
34 	 * <!-- end-user-doc -->
35 	 * @generated
36 	 */
37 	public static final BasicFactoryImpl eINSTANCE = init();
38 
39 	/**
40 	 * Creates the default factory implementation.
41 	 * <!-- begin-user-doc -->
42 	 * <!-- end-user-doc -->
43 	 * @generated
44 	 */
init()45 	public static BasicFactoryImpl init() {
46 		try {
47 			BasicFactoryImpl theBasicFactory = (BasicFactoryImpl) EPackage.Registry.INSTANCE
48 					.getEFactory(BasicPackageImpl.eNS_URI);
49 			if (theBasicFactory != null) {
50 				return theBasicFactory;
51 			}
52 		} catch (Exception exception) {
53 			EcorePlugin.INSTANCE.log(exception);
54 		}
55 		return new BasicFactoryImpl();
56 	}
57 
58 	/**
59 	 * Creates an instance of the factory.
60 	 * <!-- begin-user-doc -->
61 	 * <!-- end-user-doc -->
62 	 * @generated
63 	 */
BasicFactoryImpl()64 	public BasicFactoryImpl() {
65 		super();
66 	}
67 
68 	/**
69 	 * <!-- begin-user-doc -->
70 	 * <!-- end-user-doc -->
71 	 * @generated
72 	 */
73 	@Override
create(EClass eClass)74 	public EObject create(EClass eClass) {
75 		switch (eClass.getClassifierID()) {
76 		case BasicPackageImpl.PART_DESCRIPTOR:
77 			return (EObject) createPartDescriptor();
78 		default:
79 			throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
80 		}
81 	}
82 
83 	/**
84 	 * <!-- begin-user-doc -->
85 	 * <!-- end-user-doc -->
86 	 * @since 1.0
87 	 * @generated
88 	 */
89 	@Override
createPartDescriptor()90 	public MPartDescriptor createPartDescriptor() {
91 		return new PartDescriptorImpl();
92 	}
93 
94 	/**
95 	 * <!-- begin-user-doc -->
96 	 * <!-- end-user-doc -->
97 	 * @generated
98 	 */
getBasicPackage()99 	public BasicPackageImpl getBasicPackage() {
100 		return (BasicPackageImpl) getEPackage();
101 	}
102 
103 } //BasicFactoryImpl
104