blob: 3d905385b77a72b80d8b6e3e407fa986157bc0f2 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2019 Xored Software Inc 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
* https://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Xored Software Inc - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.eclipse.rcptt.ecl.debug.commands.impl;
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EcoreEMap;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.rcptt.ecl.core.impl.ScriptImpl;
import org.eclipse.rcptt.ecl.debug.commands.CommandsPackage;
import org.eclipse.rcptt.ecl.debug.commands.DebugScript;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Debug Script</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.rcptt.ecl.debug.commands.impl.DebugScriptImpl#getPath <em>Path</em>}</li>
* <li>{@link org.eclipse.rcptt.ecl.debug.commands.impl.DebugScriptImpl#getSession <em>Session</em>}</li>
* <li>{@link org.eclipse.rcptt.ecl.debug.commands.impl.DebugScriptImpl#getPaths <em>Paths</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class DebugScriptImpl extends ScriptImpl implements DebugScript {
/**
* The default value of the '{@link #getPath() <em>Path</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPath()
* @generated
* @ordered
*/
protected static final String PATH_EDEFAULT = null;
/**
* The cached value of the '{@link #getPath() <em>Path</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPath()
* @generated
* @ordered
*/
protected String path = PATH_EDEFAULT;
/**
* The default value of the '{@link #getSession() <em>Session</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSession()
* @generated
* @ordered
*/
protected static final String SESSION_EDEFAULT = null;
/**
* The cached value of the '{@link #getSession() <em>Session</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSession()
* @generated
* @ordered
*/
protected String session = SESSION_EDEFAULT;
/**
* The cached value of the '{@link #getPaths() <em>Paths</em>}' map.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPaths()
* @generated
* @ordered
*/
protected EMap<String, String> paths;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DebugScriptImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CommandsPackage.Literals.DEBUG_SCRIPT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPath() {
return path;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPath(String newPath) {
String oldPath = path;
path = newPath;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CommandsPackage.DEBUG_SCRIPT__PATH, oldPath, path));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getSession() {
return session;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSession(String newSession) {
String oldSession = session;
session = newSession;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CommandsPackage.DEBUG_SCRIPT__SESSION, oldSession, session));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
public EMap<String, String> getPaths() {
if (paths == null) {
paths = new EcoreEMap<String,String>(CommandsPackage.Literals.PATHS_MAP, PathsMapImpl.class, this, CommandsPackage.DEBUG_SCRIPT__PATHS);
}
return paths;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CommandsPackage.DEBUG_SCRIPT__PATHS:
return ((InternalEList<?>)getPaths()).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 CommandsPackage.DEBUG_SCRIPT__PATH:
return getPath();
case CommandsPackage.DEBUG_SCRIPT__SESSION:
return getSession();
case CommandsPackage.DEBUG_SCRIPT__PATHS:
if (coreType) return getPaths();
else return getPaths().map();
}
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 CommandsPackage.DEBUG_SCRIPT__PATH:
setPath((String)newValue);
return;
case CommandsPackage.DEBUG_SCRIPT__SESSION:
setSession((String)newValue);
return;
case CommandsPackage.DEBUG_SCRIPT__PATHS:
((EStructuralFeature.Setting)getPaths()).set(newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CommandsPackage.DEBUG_SCRIPT__PATH:
setPath(PATH_EDEFAULT);
return;
case CommandsPackage.DEBUG_SCRIPT__SESSION:
setSession(SESSION_EDEFAULT);
return;
case CommandsPackage.DEBUG_SCRIPT__PATHS:
getPaths().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CommandsPackage.DEBUG_SCRIPT__PATH:
return PATH_EDEFAULT == null ? path != null : !PATH_EDEFAULT.equals(path);
case CommandsPackage.DEBUG_SCRIPT__SESSION:
return SESSION_EDEFAULT == null ? session != null : !SESSION_EDEFAULT.equals(session);
case CommandsPackage.DEBUG_SCRIPT__PATHS:
return paths != null && !paths.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (path: ");
result.append(path);
result.append(", session: ");
result.append(session);
result.append(')');
return result.toString();
}
} //DebugScriptImpl