blob: 63fb28a75e28ce79203627b0cbf663b4dcee889b [file] [log] [blame]
/**
* Copyright (c) 2008, 2015 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*/
package org.eclipse.e4.ui.model.application.commands.impl;
import org.eclipse.e4.ui.model.application.commands.MCommand;
import org.eclipse.e4.ui.model.application.commands.MHandler;
import org.eclipse.e4.ui.model.application.impl.ContributionImpl;
import org.eclipse.emf.common.notify.Notification;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Handler</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.e4.ui.model.application.commands.impl.HandlerImpl#getCommand <em>Command</em>}</li>
* </ul>
*
* @since 1.0
* @generated
*/
public class HandlerImpl extends ContributionImpl implements MHandler {
/**
* The cached value of the '{@link #getCommand() <em>Command</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCommand()
* @generated
* @ordered
*/
protected MCommand command;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected HandlerImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CommandsPackageImpl.Literals.HANDLER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public MCommand getCommand() {
if (command != null && ((EObject) command).eIsProxy()) {
InternalEObject oldCommand = (InternalEObject) command;
command = (MCommand) eResolveProxy(oldCommand);
if (command != oldCommand) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, CommandsPackageImpl.HANDLER__COMMAND,
oldCommand, command));
}
}
return command;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public MCommand basicGetCommand() {
return command;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setCommand(MCommand newCommand) {
MCommand oldCommand = command;
command = newCommand;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CommandsPackageImpl.HANDLER__COMMAND, oldCommand,
command));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case CommandsPackageImpl.HANDLER__COMMAND:
if (resolve)
return getCommand();
return basicGetCommand();
default:
return super.eGet(featureID, resolve, coreType);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CommandsPackageImpl.HANDLER__COMMAND:
setCommand((MCommand) newValue);
return;
default:
super.eSet(featureID, newValue);
return;
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CommandsPackageImpl.HANDLER__COMMAND:
setCommand((MCommand) null);
return;
default:
super.eUnset(featureID);
return;
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CommandsPackageImpl.HANDLER__COMMAND:
return command != null;
default:
return super.eIsSet(featureID);
}
}
} //HandlerImpl