| /** |
| * <copyright> |
| * |
| * Copyright (c) 2005, 2010 SAP AG. |
| * 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: |
| * SAP AG - initial API, implementation and documentation |
| * |
| * </copyright> |
| */ |
| package org.eclipse.graphiti.mm.algorithms.styles.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.graphiti.mm.algorithms.styles.*; |
| import org.eclipse.graphiti.mm.algorithms.styles.AdaptedGradientColoredAreas; |
| import org.eclipse.graphiti.mm.algorithms.styles.Color; |
| import org.eclipse.graphiti.mm.algorithms.styles.Font; |
| import org.eclipse.graphiti.mm.algorithms.styles.GradientColoredArea; |
| import org.eclipse.graphiti.mm.algorithms.styles.GradientColoredAreas; |
| import org.eclipse.graphiti.mm.algorithms.styles.GradientColoredLocation; |
| import org.eclipse.graphiti.mm.algorithms.styles.LineStyle; |
| import org.eclipse.graphiti.mm.algorithms.styles.LocationType; |
| import org.eclipse.graphiti.mm.algorithms.styles.Orientation; |
| import org.eclipse.graphiti.mm.algorithms.styles.Point; |
| import org.eclipse.graphiti.mm.algorithms.styles.PrecisionPoint; |
| import org.eclipse.graphiti.mm.algorithms.styles.RenderingStyle; |
| import org.eclipse.graphiti.mm.algorithms.styles.Style; |
| import org.eclipse.graphiti.mm.algorithms.styles.StylesFactory; |
| import org.eclipse.graphiti.mm.algorithms.styles.StylesPackage; |
| import org.eclipse.graphiti.mm.algorithms.styles.TextStyle; |
| import org.eclipse.graphiti.mm.algorithms.styles.TextStyleRegion; |
| import org.eclipse.graphiti.mm.algorithms.styles.UnderlineStyle; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class StylesFactoryImpl extends EFactoryImpl implements StylesFactory { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static StylesFactory init() { |
| try { |
| StylesFactory theStylesFactory = (StylesFactory)EPackage.Registry.INSTANCE.getEFactory(StylesPackage.eNS_URI); |
| if (theStylesFactory != null) { |
| return theStylesFactory; |
| } |
| } |
| catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new StylesFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public StylesFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case StylesPackage.RENDERING_STYLE: return createRenderingStyle(); |
| case StylesPackage.STYLE: return createStyle(); |
| case StylesPackage.GRADIENT_COLORED_LOCATION: return createGradientColoredLocation(); |
| case StylesPackage.GRADIENT_COLORED_AREA: return createGradientColoredArea(); |
| case StylesPackage.GRADIENT_COLORED_AREAS: return createGradientColoredAreas(); |
| case StylesPackage.ADAPTED_GRADIENT_COLORED_AREAS: return createAdaptedGradientColoredAreas(); |
| case StylesPackage.FONT: return createFont(); |
| case StylesPackage.POINT: return createPoint(); |
| case StylesPackage.COLOR: return createColor(); |
| case StylesPackage.PRECISION_POINT: return createPrecisionPoint(); |
| case StylesPackage.TEXT_STYLE: return createTextStyle(); |
| case StylesPackage.TEXT_STYLE_REGION: return createTextStyleRegion(); |
| 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 StylesPackage.LINE_STYLE: |
| return createLineStyleFromString(eDataType, initialValue); |
| case StylesPackage.ORIENTATION: |
| return createOrientationFromString(eDataType, initialValue); |
| case StylesPackage.LOCATION_TYPE: |
| return createLocationTypeFromString(eDataType, initialValue); |
| case StylesPackage.UNDERLINE_STYLE: |
| return createUnderlineStyleFromString(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 StylesPackage.LINE_STYLE: |
| return convertLineStyleToString(eDataType, instanceValue); |
| case StylesPackage.ORIENTATION: |
| return convertOrientationToString(eDataType, instanceValue); |
| case StylesPackage.LOCATION_TYPE: |
| return convertLocationTypeToString(eDataType, instanceValue); |
| case StylesPackage.UNDERLINE_STYLE: |
| return convertUnderlineStyleToString(eDataType, instanceValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public RenderingStyle createRenderingStyle() { |
| RenderingStyleImpl renderingStyle = new RenderingStyleImpl(); |
| return renderingStyle; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Style createStyle() { |
| StyleImpl style = new StyleImpl(); |
| return style; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public GradientColoredLocation createGradientColoredLocation() { |
| GradientColoredLocationImpl gradientColoredLocation = new GradientColoredLocationImpl(); |
| return gradientColoredLocation; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public GradientColoredArea createGradientColoredArea() { |
| GradientColoredAreaImpl gradientColoredArea = new GradientColoredAreaImpl(); |
| return gradientColoredArea; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public GradientColoredAreas createGradientColoredAreas() { |
| GradientColoredAreasImpl gradientColoredAreas = new GradientColoredAreasImpl(); |
| return gradientColoredAreas; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public AdaptedGradientColoredAreas createAdaptedGradientColoredAreas() { |
| AdaptedGradientColoredAreasImpl adaptedGradientColoredAreas = new AdaptedGradientColoredAreasImpl(); |
| return adaptedGradientColoredAreas; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Font createFont() { |
| FontImpl font = new FontImpl(); |
| return font; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Point createPoint() { |
| PointImpl point = new PointImpl(); |
| return point; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Color createColor() { |
| ColorImpl color = new ColorImpl(); |
| return color; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public PrecisionPoint createPrecisionPoint() { |
| PrecisionPointImpl precisionPoint = new PrecisionPointImpl(); |
| return precisionPoint; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TextStyle createTextStyle() { |
| TextStyleImpl textStyle = new TextStyleImpl(); |
| return textStyle; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TextStyleRegion createTextStyleRegion() { |
| TextStyleRegionImpl textStyleRegion = new TextStyleRegionImpl(); |
| return textStyleRegion; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LineStyle createLineStyleFromString(EDataType eDataType, String initialValue) { |
| LineStyle result = LineStyle.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 convertLineStyleToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Orientation createOrientationFromString(EDataType eDataType, String initialValue) { |
| Orientation result = Orientation.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 convertOrientationToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LocationType createLocationTypeFromString(EDataType eDataType, String initialValue) { |
| LocationType result = LocationType.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 convertLocationTypeToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public UnderlineStyle createUnderlineStyleFromString(EDataType eDataType, String initialValue) { |
| UnderlineStyle result = UnderlineStyle.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 convertUnderlineStyleToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public StylesPackage getStylesPackage() { |
| return (StylesPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static StylesPackage getPackage() { |
| return StylesPackage.eINSTANCE; |
| } |
| |
| } //StylesFactoryImpl |