blob: c61ab7114c58a4c1a5437e2bb178eeba3edcf368 [file] [log] [blame]
/*
* Copyright (c) 2005 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: ExtensionPointImpl.java,v 1.1 2005/11/14 22:26:05 khussey Exp $
*/
package org.eclipse.uml2.uml.internal.impl;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.uml2.uml.ExtensionPoint;
import org.eclipse.uml2.uml.StringExpression;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.UseCase;
import org.eclipse.uml2.uml.VisibilityKind;
import org.eclipse.uml2.uml.internal.operations.ExtensionPointOperations;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Extension Point</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.uml2.uml.internal.impl.ExtensionPointImpl#getUseCase <em>Use Case</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ExtensionPointImpl
extends RedefinableElementImpl
implements ExtensionPoint {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ExtensionPointImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return UMLPackage.eINSTANCE.getExtensionPoint();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public UseCase getUseCase() {
if (eContainerFeatureID != UMLPackage.EXTENSION_POINT__USE_CASE)
return null;
return (UseCase) eContainer;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUseCase(UseCase newUseCase) {
if (newUseCase != eContainer
|| (eContainerFeatureID != UMLPackage.EXTENSION_POINT__USE_CASE && newUseCase != null)) {
if (EcoreUtil.isAncestor(this, (EObject) newUseCase))
throw new IllegalArgumentException(
"Recursive containment not allowed for " + toString()); //$NON-NLS-1$
NotificationChain msgs = null;
if (eContainer != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newUseCase != null)
msgs = ((InternalEObject) newUseCase).eInverseAdd(this,
UMLPackage.USE_CASE__EXTENSION_POINT, UseCase.class, msgs);
msgs = eBasicSetContainer((InternalEObject) newUseCase,
UMLPackage.EXTENSION_POINT__USE_CASE, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
UMLPackage.EXTENSION_POINT__USE_CASE, newUseCase, newUseCase));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateMustHaveName(DiagnosticChain diagnostics, Map context) {
return ExtensionPointOperations.validateMustHaveName(this, diagnostics,
context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseAdd(InternalEObject otherEnd,
int featureID, Class baseClass, NotificationChain msgs) {
if (featureID >= 0) {
switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
case UMLPackage.EXTENSION_POINT__EANNOTATIONS :
return ((InternalEList) getEAnnotations()).basicAdd(
otherEnd, msgs);
case UMLPackage.EXTENSION_POINT__CLIENT_DEPENDENCY :
return ((InternalEList) getClientDependencies()).basicAdd(
otherEnd, msgs);
case UMLPackage.EXTENSION_POINT__USE_CASE :
if (eContainer != null)
msgs = eBasicRemoveFromContainer(msgs);
return eBasicSetContainer(otherEnd,
UMLPackage.EXTENSION_POINT__USE_CASE, msgs);
default :
return eDynamicInverseAdd(otherEnd, featureID, baseClass,
msgs);
}
}
if (eContainer != null)
msgs = eBasicRemoveFromContainer(msgs);
return eBasicSetContainer(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, Class baseClass, NotificationChain msgs) {
if (featureID >= 0) {
switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
case UMLPackage.EXTENSION_POINT__EANNOTATIONS :
return ((InternalEList) getEAnnotations()).basicRemove(
otherEnd, msgs);
case UMLPackage.EXTENSION_POINT__OWNED_COMMENT :
return ((InternalEList) getOwnedComments()).basicRemove(
otherEnd, msgs);
case UMLPackage.EXTENSION_POINT__CLIENT_DEPENDENCY :
return ((InternalEList) getClientDependencies())
.basicRemove(otherEnd, msgs);
case UMLPackage.EXTENSION_POINT__NAME_EXPRESSION :
return basicSetNameExpression(null, msgs);
case UMLPackage.EXTENSION_POINT__USE_CASE :
return eBasicSetContainer(null,
UMLPackage.EXTENSION_POINT__USE_CASE, msgs);
default :
return eDynamicInverseRemove(otherEnd, featureID,
baseClass, msgs);
}
}
return eBasicSetContainer(null, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) {
if (eContainerFeatureID >= 0) {
switch (eContainerFeatureID) {
case UMLPackage.EXTENSION_POINT__USE_CASE :
return eContainer.eInverseRemove(this,
UMLPackage.USE_CASE__EXTENSION_POINT, UseCase.class,
msgs);
default :
return eDynamicBasicRemoveFromContainer(msgs);
}
}
return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE
- eContainerFeatureID, null, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(EStructuralFeature eFeature, boolean resolve) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UMLPackage.EXTENSION_POINT__EANNOTATIONS :
return getEAnnotations();
case UMLPackage.EXTENSION_POINT__OWNED_ELEMENT :
return getOwnedElements();
case UMLPackage.EXTENSION_POINT__OWNER :
if (resolve)
return getOwner();
return basicGetOwner();
case UMLPackage.EXTENSION_POINT__OWNED_COMMENT :
return getOwnedComments();
case UMLPackage.EXTENSION_POINT__NAME :
return getName();
case UMLPackage.EXTENSION_POINT__VISIBILITY :
return getVisibility();
case UMLPackage.EXTENSION_POINT__QUALIFIED_NAME :
return getQualifiedName();
case UMLPackage.EXTENSION_POINT__CLIENT_DEPENDENCY :
return getClientDependencies();
case UMLPackage.EXTENSION_POINT__NAMESPACE :
if (resolve)
return getNamespace();
return basicGetNamespace();
case UMLPackage.EXTENSION_POINT__NAME_EXPRESSION :
return getNameExpression();
case UMLPackage.EXTENSION_POINT__IS_LEAF :
return isLeaf()
? Boolean.TRUE
: Boolean.FALSE;
case UMLPackage.EXTENSION_POINT__REDEFINED_ELEMENT :
return getRedefinedElements();
case UMLPackage.EXTENSION_POINT__REDEFINITION_CONTEXT :
return getRedefinitionContexts();
case UMLPackage.EXTENSION_POINT__USE_CASE :
return getUseCase();
}
return eDynamicGet(eFeature, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(EStructuralFeature eFeature, Object newValue) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UMLPackage.EXTENSION_POINT__EANNOTATIONS :
getEAnnotations().clear();
getEAnnotations().addAll((Collection) newValue);
return;
case UMLPackage.EXTENSION_POINT__OWNED_COMMENT :
getOwnedComments().clear();
getOwnedComments().addAll((Collection) newValue);
return;
case UMLPackage.EXTENSION_POINT__NAME :
setName((String) newValue);
return;
case UMLPackage.EXTENSION_POINT__VISIBILITY :
setVisibility((VisibilityKind) newValue);
return;
case UMLPackage.EXTENSION_POINT__CLIENT_DEPENDENCY :
getClientDependencies().clear();
getClientDependencies().addAll((Collection) newValue);
return;
case UMLPackage.EXTENSION_POINT__NAME_EXPRESSION :
setNameExpression((StringExpression) newValue);
return;
case UMLPackage.EXTENSION_POINT__IS_LEAF :
setIsLeaf(((Boolean) newValue).booleanValue());
return;
case UMLPackage.EXTENSION_POINT__USE_CASE :
setUseCase((UseCase) newValue);
return;
}
eDynamicSet(eFeature, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UMLPackage.EXTENSION_POINT__EANNOTATIONS :
getEAnnotations().clear();
return;
case UMLPackage.EXTENSION_POINT__OWNED_COMMENT :
getOwnedComments().clear();
return;
case UMLPackage.EXTENSION_POINT__NAME :
setName(NAME_EDEFAULT);
return;
case UMLPackage.EXTENSION_POINT__VISIBILITY :
setVisibility(VISIBILITY_EDEFAULT);
return;
case UMLPackage.EXTENSION_POINT__CLIENT_DEPENDENCY :
getClientDependencies().clear();
return;
case UMLPackage.EXTENSION_POINT__NAME_EXPRESSION :
setNameExpression((StringExpression) null);
return;
case UMLPackage.EXTENSION_POINT__IS_LEAF :
setIsLeaf(IS_LEAF_EDEFAULT);
return;
case UMLPackage.EXTENSION_POINT__USE_CASE :
setUseCase((UseCase) null);
return;
}
eDynamicUnset(eFeature);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UMLPackage.EXTENSION_POINT__EANNOTATIONS :
return eAnnotations != null && !eAnnotations.isEmpty();
case UMLPackage.EXTENSION_POINT__OWNED_ELEMENT :
return isSetOwnedElements();
case UMLPackage.EXTENSION_POINT__OWNER :
return isSetOwner();
case UMLPackage.EXTENSION_POINT__OWNED_COMMENT :
List ownedComment = (List) eVirtualGet(UMLPackage.EXTENSION_POINT__OWNED_COMMENT);
return ownedComment != null && !ownedComment.isEmpty();
case UMLPackage.EXTENSION_POINT__NAME :
String name = eVirtualIsSet(UMLPackage.EXTENSION_POINT__NAME)
? (String) eVirtualGet(UMLPackage.EXTENSION_POINT__NAME)
: NAME_EDEFAULT;
return NAME_EDEFAULT == null
? name != null
: !NAME_EDEFAULT.equals(name);
case UMLPackage.EXTENSION_POINT__VISIBILITY :
return eVirtualIsSet(UMLPackage.EXTENSION_POINT__VISIBILITY)
&& eVirtualGet(UMLPackage.EXTENSION_POINT__VISIBILITY) != VISIBILITY_EDEFAULT;
case UMLPackage.EXTENSION_POINT__QUALIFIED_NAME :
return QUALIFIED_NAME_EDEFAULT == null
? getQualifiedName() != null
: !QUALIFIED_NAME_EDEFAULT.equals(getQualifiedName());
case UMLPackage.EXTENSION_POINT__CLIENT_DEPENDENCY :
List clientDependency = (List) eVirtualGet(UMLPackage.EXTENSION_POINT__CLIENT_DEPENDENCY);
return clientDependency != null && !clientDependency.isEmpty();
case UMLPackage.EXTENSION_POINT__NAMESPACE :
return isSetNamespace();
case UMLPackage.EXTENSION_POINT__NAME_EXPRESSION :
return eVirtualGet(UMLPackage.EXTENSION_POINT__NAME_EXPRESSION) != null;
case UMLPackage.EXTENSION_POINT__IS_LEAF :
return ((eFlags & IS_LEAF_EFLAG) != 0) != IS_LEAF_EDEFAULT;
case UMLPackage.EXTENSION_POINT__REDEFINED_ELEMENT :
return isSetRedefinedElements();
case UMLPackage.EXTENSION_POINT__REDEFINITION_CONTEXT :
return isSetRedefinitionContexts();
case UMLPackage.EXTENSION_POINT__USE_CASE :
return getUseCase() != null;
}
return eDynamicIsSet(eFeature);
}
} //ExtensionPointImpl