diff options
Diffstat (limited to 'plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/MacroImpl.java')
-rw-r--r-- | plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/MacroImpl.java | 251 |
1 files changed, 251 insertions, 0 deletions
diff --git a/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/MacroImpl.java b/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/MacroImpl.java new file mode 100644 index 000000000..6976c7298 --- /dev/null +++ b/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/MacroImpl.java @@ -0,0 +1,251 @@ +/* + * Copyright (c) 2019 Ed Merks (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Ed Merks - initial API and implementation + */ +package org.eclipse.oomph.setup.impl; + +import org.eclipse.oomph.setup.Macro; +import org.eclipse.oomph.setup.MacroTask; +import org.eclipse.oomph.setup.Parameter; +import org.eclipse.oomph.setup.Scope; +import org.eclipse.oomph.setup.ScopeType; +import org.eclipse.oomph.setup.SetupPackage; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import java.util.Collection; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Macro</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * </p> + * <ul> + * <li>{@link org.eclipse.oomph.setup.impl.MacroImpl#getLogicalContainer <em>Logical Container</em>}</li> + * <li>{@link org.eclipse.oomph.setup.impl.MacroImpl#getParameters <em>Parameters</em>}</li> + * </ul> + * + * @generated + */ +public class MacroImpl extends ScopeImpl implements Macro +{ + /** + * The cached value of the '{@link #getLogicalContainer() <em>Logical Container</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getLogicalContainer() + * @generated + * @ordered + */ + protected MacroTask logicalContainer; + + /** + * The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getParameters() + * @generated + * @ordered + */ + protected EList<Parameter> parameters; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected MacroImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() + { + return SetupPackage.Literals.MACRO; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MacroTask getLogicalContainer() + { + return logicalContainer; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setLogicalContainer(MacroTask newLogicalContainer) + { + MacroTask oldLogicalContainer = logicalContainer; + logicalContainer = newLogicalContainer; + if (eNotificationRequired()) + { + eNotify(new ENotificationImpl(this, Notification.SET, SetupPackage.MACRO__LOGICAL_CONTAINER, oldLogicalContainer, logicalContainer)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Parameter> getParameters() + { + if (parameters == null) + { + parameters = new EObjectContainmentEList<Parameter>(Parameter.class, this, SetupPackage.MACRO__PARAMETERS); + } + return parameters; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case SetupPackage.MACRO__PARAMETERS: + return ((InternalEList<?>)getParameters()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case SetupPackage.MACRO__LOGICAL_CONTAINER: + return getLogicalContainer(); + case SetupPackage.MACRO__PARAMETERS: + return getParameters(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case SetupPackage.MACRO__LOGICAL_CONTAINER: + setLogicalContainer((MacroTask)newValue); + return; + case SetupPackage.MACRO__PARAMETERS: + getParameters().clear(); + getParameters().addAll((Collection<? extends Parameter>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case SetupPackage.MACRO__LOGICAL_CONTAINER: + setLogicalContainer((MacroTask)null); + return; + case SetupPackage.MACRO__PARAMETERS: + getParameters().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case SetupPackage.MACRO__LOGICAL_CONTAINER: + return logicalContainer != null; + case SetupPackage.MACRO__PARAMETERS: + return parameters != null && !parameters.isEmpty(); + } + return super.eIsSet(featureID); + } + + @Override + public ScopeType getType() + { + return ScopeType.MACRO; + } + + @Override + public Scope getParentScope() + { + MacroTask logicalContainer = getLogicalContainer(); + if (logicalContainer != null) + { + return logicalContainer.getScope(); + } + + return null; + } + + @Override + public String getQualifiedName() + { + Scope parentScope = getParentScope(); + if (parentScope != null) + { + return parentScope.getQualifiedName(); + } + + return super.getQualifiedName(); + } + +} // MacroImpl |