| /******************************************************************************* |
| * Copyright (c) 2010, 2011 Obeo. |
| * 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: |
| * Obeo - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.mylyn.docs.intent.core.indexer.impl; |
| |
| 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; |
| import org.eclipse.mylyn.docs.intent.core.indexer.*; |
| import org.eclipse.mylyn.docs.intent.core.indexer.INDEX_ENTRY_TYPE; |
| import org.eclipse.mylyn.docs.intent.core.indexer.IntentIndex; |
| import org.eclipse.mylyn.docs.intent.core.indexer.IntentIndexEntry; |
| import org.eclipse.mylyn.docs.intent.core.indexer.IntentIndexerFactory; |
| import org.eclipse.mylyn.docs.intent.core.indexer.IntentIndexerPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class IntentIndexerFactoryImpl extends EFactoryImpl implements IntentIndexerFactory { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static IntentIndexerFactory init() { |
| try { |
| IntentIndexerFactory theIntentIndexerFactory = (IntentIndexerFactory)EPackage.Registry.INSTANCE |
| .getEFactory("http://www.eclipse.org/intent/indexer/0.7"); |
| if (theIntentIndexerFactory != null) { |
| return theIntentIndexerFactory; |
| } |
| } catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new IntentIndexerFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public IntentIndexerFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case IntentIndexerPackage.INTENT_INDEX: |
| return (EObject)createIntentIndex(); |
| case IntentIndexerPackage.INTENT_INDEX_ENTRY: |
| return (EObject)createIntentIndexEntry(); |
| default: |
| throw new IllegalArgumentException("The class '" + eClass.getName() |
| + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object createFromString(EDataType eDataType, String initialValue) { |
| switch (eDataType.getClassifierID()) { |
| case IntentIndexerPackage.INDEX_ENTRY_TYPE: |
| return createINDEX_ENTRY_TYPEFromString(eDataType, initialValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() |
| + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String convertToString(EDataType eDataType, Object instanceValue) { |
| switch (eDataType.getClassifierID()) { |
| case IntentIndexerPackage.INDEX_ENTRY_TYPE: |
| return convertINDEX_ENTRY_TYPEToString(eDataType, instanceValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() |
| + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public IntentIndex createIntentIndex() { |
| IntentIndexImpl intentIndex = new IntentIndexImpl(); |
| return intentIndex; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public IntentIndexEntry createIntentIndexEntry() { |
| IntentIndexEntryImpl intentIndexEntry = new IntentIndexEntryImpl(); |
| return intentIndexEntry; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public INDEX_ENTRY_TYPE createINDEX_ENTRY_TYPEFromString(EDataType eDataType, String initialValue) { |
| INDEX_ENTRY_TYPE result = INDEX_ENTRY_TYPE.get(initialValue); |
| if (result == null) |
| throw new IllegalArgumentException("The value '" + initialValue |
| + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
| return result; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertINDEX_ENTRY_TYPEToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public IntentIndexerPackage getIntentIndexerPackage() { |
| return (IntentIndexerPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static IntentIndexerPackage getPackage() { |
| return IntentIndexerPackage.eINSTANCE; |
| } |
| |
| } //IntentIndexerFactoryImpl |