/** * Copyright (c) 2008 xored software, Inc. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * xored software, Inc. - initial API and Implementation (Alex Panchenko) * * * $Id: PreferencesFactoryImpl.java,v 1.5 2009/10/26 12:41:50 apanchenk Exp $ */ package org.eclipse.dltk.tcl.activestatedebugger.preferences.impl; import org.eclipse.dltk.tcl.activestatedebugger.preferences.*; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.impl.EFactoryImpl; import org.eclipse.emf.ecore.plugin.EcorePlugin; /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> * @generated */ public class PreferencesFactoryImpl extends EFactoryImpl implements PreferencesFactory { /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static PreferencesFactory init() { try { PreferencesFactory thePreferencesFactory = (PreferencesFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/dltk/tcl/activestatedebugger.ecore"); //$NON-NLS-1$ if (thePreferencesFactory != null) { return thePreferencesFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new PreferencesFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public PreferencesFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case PreferencesPackage.MODEL_ELEMENT_PATTERN: return createModelElementPattern(); case PreferencesPackage.INSTRUMENTATION_CONFIG: return createInstrumentationConfig(); case PreferencesPackage.PATTERN: return createPattern(); case PreferencesPackage.LIBRARY_PATTERN: return createLibraryPattern(); case PreferencesPackage.PACKAGE_PATTERN: return createPackagePattern(); case PreferencesPackage.SOURCE_PATTERN: return createSourcePattern(); case PreferencesPackage.CONTAINER_PATTERN: return createContainerPattern(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object createFromString(EDataType eDataType, String initialValue) { switch (eDataType.getClassifierID()) { case PreferencesPackage.INSTRUMENTATION_MODE: return createInstrumentationModeFromString(eDataType, initialValue); case PreferencesPackage.CONTAINER_TYPE: return createContainerTypeFromString(eDataType, initialValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String convertToString(EDataType eDataType, Object instanceValue) { switch (eDataType.getClassifierID()) { case PreferencesPackage.INSTRUMENTATION_MODE: return convertInstrumentationModeToString(eDataType, instanceValue); case PreferencesPackage.CONTAINER_TYPE: return convertContainerTypeToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ModelElementPattern createModelElementPattern() { ModelElementPatternImpl modelElementPattern = new ModelElementPatternImpl(); return modelElementPattern; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public InstrumentationConfig createInstrumentationConfig() { InstrumentationConfigImpl instrumentationConfig = new InstrumentationConfigImpl(); return instrumentationConfig; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Pattern createPattern() { PatternImpl pattern = new PatternImpl(); return pattern; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public LibraryPattern createLibraryPattern() { LibraryPatternImpl libraryPattern = new LibraryPatternImpl(); return libraryPattern; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public PackagePattern createPackagePattern() { PackagePatternImpl packagePattern = new PackagePatternImpl(); return packagePattern; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SourcePattern createSourcePattern() { SourcePatternImpl sourcePattern = new SourcePatternImpl(); return sourcePattern; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ContainerPattern createContainerPattern() { ContainerPatternImpl containerPattern = new ContainerPatternImpl(); return containerPattern; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public InstrumentationMode createInstrumentationModeFromString(EDataType eDataType, String initialValue) { InstrumentationMode result = InstrumentationMode.get(initialValue); if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return result; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String convertInstrumentationModeToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ContainerType createContainerTypeFromString(EDataType eDataType, String initialValue) { ContainerType result = ContainerType.get(initialValue); if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return result; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String convertContainerTypeToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public PreferencesPackage getPreferencesPackage() { return (PreferencesPackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static PreferencesPackage getPackage() { return PreferencesPackage.eINSTANCE; } } //PreferencesFactoryImpl