blob: 6980aeb2e8f1a39ced3ce97e240ab1fb0b2d319b [file] [log] [blame]
/*
* Copyright (c) 2005, 2007 IBM Corporation 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:
* IBM - initial API and implementation
*
* $Id: ConnectableElementTemplateParameterImpl.java,v 1.18 2007/04/25 17:47:01 khussey Exp $
*/
package org.eclipse.uml2.uml.internal.impl;
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.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.uml2.uml.ConnectableElement;
import org.eclipse.uml2.uml.ConnectableElementTemplateParameter;
import org.eclipse.uml2.uml.ParameterableElement;
import org.eclipse.uml2.uml.UMLPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Connectable Element Template Parameter</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.uml2.uml.internal.impl.ConnectableElementTemplateParameterImpl#getParameteredElement <em>Parametered Element</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ConnectableElementTemplateParameterImpl
extends TemplateParameterImpl
implements ConnectableElementTemplateParameter {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConnectableElementTemplateParameterImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return UMLPackage.Literals.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ParameterableElement getParameteredElement() {
if (parameteredElement != null && parameteredElement.eIsProxy()) {
InternalEObject oldParameteredElement = (InternalEObject) parameteredElement;
parameteredElement = (ParameterableElement) eResolveProxy(oldParameteredElement);
if (parameteredElement != oldParameteredElement) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(
this,
Notification.RESOLVE,
UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT,
oldParameteredElement, parameteredElement));
}
}
return parameteredElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ParameterableElement basicGetParameteredElement() {
return parameteredElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetParameteredElementGen(
ParameterableElement newParameteredElement, NotificationChain msgs) {
ParameterableElement oldParameteredElement = parameteredElement;
parameteredElement = newParameteredElement;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(
this,
Notification.SET,
UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT,
oldParameteredElement, newParameteredElement);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
@Override
public NotificationChain basicSetParameteredElement(
ParameterableElement newParameteredElement, NotificationChain msgs) {
if (newParameteredElement != null
&& !(newParameteredElement instanceof ConnectableElement)) {
throw new IllegalArgumentException(newParameteredElement.toString());
}
msgs = basicSetParameteredElementGen(newParameteredElement, msgs);
Resource.Internal eInternalResource = eInternalResource();
if (eInternalResource == null || !eInternalResource.isLoading()) {
if (ownedParameteredElement != null
&& ownedParameteredElement != newParameteredElement) {
setOwnedParameteredElement(null);
}
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setParameteredElement(ParameterableElement newParameteredElement) {
if (newParameteredElement != parameteredElement) {
NotificationChain msgs = null;
if (parameteredElement != null)
msgs = ((InternalEObject) parameteredElement).eInverseRemove(
this, UMLPackage.PARAMETERABLE_ELEMENT__TEMPLATE_PARAMETER,
ParameterableElement.class, msgs);
if (newParameteredElement != null)
msgs = ((InternalEObject) newParameteredElement).eInverseAdd(
this, UMLPackage.PARAMETERABLE_ELEMENT__TEMPLATE_PARAMETER,
ParameterableElement.class, msgs);
msgs = basicSetParameteredElement(newParameteredElement, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(
this,
Notification.SET,
UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT,
newParameteredElement, newParameteredElement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetParameteredElement() {
return parameteredElement != null;
}
} //ConnectableElementTemplateParameterImpl