blob: a6d4a7c9916459162c03510cc88572a1707fdbf7 [file] [log] [blame]
/**
* Copyright (c) 2008 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 Corporation - initial API and implementation
*
* $Id: ApplicationImpl.java,v 1.1 2008/11/11 18:19:11 bbokowski Exp $
*/
package org.eclipse.e4.ui.model.internal.application;
import java.util.Collection;
import org.eclipse.e4.ui.model.application.Application;
import org.eclipse.e4.ui.model.application.ApplicationPackage;
import org.eclipse.e4.ui.model.application.Command;
import org.eclipse.e4.ui.model.application.Window;
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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Application</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.e4.ui.model.internal.application.ApplicationImpl#getWindows <em>Windows</em>}</li>
* <li>{@link org.eclipse.e4.ui.model.internal.application.ApplicationImpl#getCommand <em>Command</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ApplicationImpl<W extends Window<?>> extends ApplicationElementImpl implements Application<W> {
/**
* The cached value of the '{@link #getWindows() <em>Windows</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getWindows()
* @generated
* @ordered
*/
protected EList<W> windows;
/**
* The cached value of the '{@link #getCommand() <em>Command</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCommand()
* @generated
* @ordered
*/
protected EList<Command> command;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ApplicationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ApplicationPackage.Literals.APPLICATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<W> getWindows() {
if (windows == null) {
windows = new EObjectContainmentEList<W>(Window.class, this, ApplicationPackage.APPLICATION__WINDOWS);
}
return windows;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Command> getCommand() {
if (command == null) {
command = new EObjectContainmentEList<Command>(Command.class, this, ApplicationPackage.APPLICATION__COMMAND);
}
return command;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ApplicationPackage.APPLICATION__WINDOWS:
return ((InternalEList<?>)getWindows()).basicRemove(otherEnd, msgs);
case ApplicationPackage.APPLICATION__COMMAND:
return ((InternalEList<?>)getCommand()).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 ApplicationPackage.APPLICATION__WINDOWS:
return getWindows();
case ApplicationPackage.APPLICATION__COMMAND:
return getCommand();
}
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 ApplicationPackage.APPLICATION__WINDOWS:
getWindows().clear();
getWindows().addAll((Collection<? extends W>)newValue);
return;
case ApplicationPackage.APPLICATION__COMMAND:
getCommand().clear();
getCommand().addAll((Collection<? extends Command>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ApplicationPackage.APPLICATION__WINDOWS:
getWindows().clear();
return;
case ApplicationPackage.APPLICATION__COMMAND:
getCommand().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ApplicationPackage.APPLICATION__WINDOWS:
return windows != null && !windows.isEmpty();
case ApplicationPackage.APPLICATION__COMMAND:
return command != null && !command.isEmpty();
}
return super.eIsSet(featureID);
}
} //ApplicationImpl