| /******************************************************************************* |
| * Copyright (c) 2015 Tasktop Technologies and others. |
| * 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: |
| * Tasktop Technologies - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.mylyn.builds.internal.core; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.EObjectImpl; |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| import org.eclipse.mylyn.builds.core.IBuildPlan; |
| import org.eclipse.mylyn.builds.core.IParameterDefinition; |
| |
| /** |
| * <!-- begin-user-doc --> A representation of the model object '<em><b>Parameter Definition</b></em>'. <!-- |
| * end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.mylyn.builds.internal.core.ParameterDefinition#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.mylyn.builds.internal.core.ParameterDefinition#getDescription <em>Description</em>}</li> |
| * <li>{@link org.eclipse.mylyn.builds.internal.core.ParameterDefinition#getContainingBuildPlan <em>Containing Build |
| * Plan</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public abstract class ParameterDefinition extends EObjectImpl implements IParameterDefinition { |
| /** |
| * The default value of the '{@link #getName() <em>Name</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc |
| * --> |
| * |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc |
| * --> |
| * |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected String name = NAME_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getDescription() <em>Description</em>}' attribute. <!-- begin-user-doc --> <!-- |
| * end-user-doc --> |
| * |
| * @see #getDescription() |
| * @generated |
| * @ordered |
| */ |
| protected static final String DESCRIPTION_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. <!-- begin-user-doc --> <!-- |
| * end-user-doc --> |
| * |
| * @see #getDescription() |
| * @generated |
| * @ordered |
| */ |
| protected String description = DESCRIPTION_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected ParameterDefinition() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return BuildPackage.Literals.PARAMETER_DEFINITION; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Name</em>' attribute isn't clear, there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setName(String newName) { |
| String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, BuildPackage.PARAMETER_DEFINITION__NAME, oldName, |
| name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Description</em>' attribute isn't clear, there really should be more of a description |
| * here... |
| * </p> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String getDescription() { |
| return description; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setDescription(String newDescription) { |
| String oldDescription = description; |
| description = newDescription; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, BuildPackage.PARAMETER_DEFINITION__DESCRIPTION, |
| oldDescription, description)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Containing Build Plan</em>' container reference isn't clear, there really should be |
| * more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public IBuildPlan getContainingBuildPlan() { |
| if (eContainerFeatureID() != BuildPackage.PARAMETER_DEFINITION__CONTAINING_BUILD_PLAN) |
| return null; |
| return (IBuildPlan) eContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetContainingBuildPlan(IBuildPlan newContainingBuildPlan, NotificationChain msgs) { |
| msgs = eBasicSetContainer((InternalEObject) newContainingBuildPlan, |
| BuildPackage.PARAMETER_DEFINITION__CONTAINING_BUILD_PLAN, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setContainingBuildPlan(IBuildPlan newContainingBuildPlan) { |
| if (newContainingBuildPlan != eInternalContainer() |
| || (eContainerFeatureID() != BuildPackage.PARAMETER_DEFINITION__CONTAINING_BUILD_PLAN && newContainingBuildPlan != null)) { |
| if (EcoreUtil.isAncestor(this, (EObject) newContainingBuildPlan)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); //$NON-NLS-1$ |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if (newContainingBuildPlan != null) |
| msgs = ((InternalEObject) newContainingBuildPlan).eInverseAdd(this, |
| BuildPackage.BUILD_PLAN__PARAMETER_DEFINITIONS, IBuildPlan.class, msgs); |
| msgs = basicSetContainingBuildPlan(newContainingBuildPlan, msgs); |
| if (msgs != null) |
| msgs.dispatch(); |
| } else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, |
| BuildPackage.PARAMETER_DEFINITION__CONTAINING_BUILD_PLAN, newContainingBuildPlan, |
| newContainingBuildPlan)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case BuildPackage.PARAMETER_DEFINITION__CONTAINING_BUILD_PLAN: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetContainingBuildPlan((IBuildPlan) otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case BuildPackage.PARAMETER_DEFINITION__CONTAINING_BUILD_PLAN: |
| return basicSetContainingBuildPlan(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| switch (eContainerFeatureID()) { |
| case BuildPackage.PARAMETER_DEFINITION__CONTAINING_BUILD_PLAN: |
| return eInternalContainer().eInverseRemove(this, BuildPackage.BUILD_PLAN__PARAMETER_DEFINITIONS, |
| IBuildPlan.class, msgs); |
| } |
| return super.eBasicRemoveFromContainerFeature(msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case BuildPackage.PARAMETER_DEFINITION__NAME: |
| return getName(); |
| case BuildPackage.PARAMETER_DEFINITION__DESCRIPTION: |
| return getDescription(); |
| case BuildPackage.PARAMETER_DEFINITION__CONTAINING_BUILD_PLAN: |
| return getContainingBuildPlan(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case BuildPackage.PARAMETER_DEFINITION__NAME: |
| setName((String) newValue); |
| return; |
| case BuildPackage.PARAMETER_DEFINITION__DESCRIPTION: |
| setDescription((String) newValue); |
| return; |
| case BuildPackage.PARAMETER_DEFINITION__CONTAINING_BUILD_PLAN: |
| setContainingBuildPlan((IBuildPlan) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case BuildPackage.PARAMETER_DEFINITION__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case BuildPackage.PARAMETER_DEFINITION__DESCRIPTION: |
| setDescription(DESCRIPTION_EDEFAULT); |
| return; |
| case BuildPackage.PARAMETER_DEFINITION__CONTAINING_BUILD_PLAN: |
| setContainingBuildPlan((IBuildPlan) null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case BuildPackage.PARAMETER_DEFINITION__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case BuildPackage.PARAMETER_DEFINITION__DESCRIPTION: |
| return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); |
| case BuildPackage.PARAMETER_DEFINITION__CONTAINING_BUILD_PLAN: |
| return getContainingBuildPlan() != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) |
| return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (name: "); //$NON-NLS-1$ |
| result.append(name); |
| result.append(", description: "); //$NON-NLS-1$ |
| result.append(description); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // ParameterDefinition |