| /******************************************************************************* |
| * 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 v1.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.filesystem.impl; |
| |
| import org.eclipse.rcptt.core.scenario.impl.ContextImpl; |
| |
| import org.eclipse.rcptt.filesystem.FSFolder; |
| import org.eclipse.rcptt.filesystem.FilesystemContext; |
| import org.eclipse.rcptt.filesystem.FilesystemPackage; |
| |
| 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Context</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.filesystem.impl.FilesystemContextImpl#getPath <em>Path</em>}</li> |
| * <li>{@link org.eclipse.rcptt.filesystem.impl.FilesystemContextImpl#getRoot <em>Root</em>}</li> |
| * <li>{@link org.eclipse.rcptt.filesystem.impl.FilesystemContextImpl#isClear <em>Clear</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class FilesystemContextImpl extends ContextImpl implements FilesystemContext { |
| /** |
| * 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 cached value of the '{@link #getRoot() <em>Root</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRoot() |
| * @generated |
| * @ordered |
| */ |
| protected FSFolder root; |
| /** |
| * The default value of the '{@link #isClear() <em>Clear</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isClear() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean CLEAR_EDEFAULT = true; |
| /** |
| * The cached value of the '{@link #isClear() <em>Clear</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isClear() |
| * @generated |
| * @ordered |
| */ |
| protected boolean clear = CLEAR_EDEFAULT; |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected FilesystemContextImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FilesystemPackage.Literals.FILESYSTEM_CONTEXT; |
| } |
| |
| /** |
| * <!-- 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, FilesystemPackage.FILESYSTEM_CONTEXT__PATH, oldPath, path)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FSFolder getRoot() { |
| return root; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetRoot(FSFolder newRoot, NotificationChain msgs) { |
| FSFolder oldRoot = root; |
| root = newRoot; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilesystemPackage.FILESYSTEM_CONTEXT__ROOT, oldRoot, newRoot); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRoot(FSFolder newRoot) { |
| if (newRoot != root) { |
| NotificationChain msgs = null; |
| if (root != null) |
| msgs = ((InternalEObject)root).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilesystemPackage.FILESYSTEM_CONTEXT__ROOT, null, msgs); |
| if (newRoot != null) |
| msgs = ((InternalEObject)newRoot).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilesystemPackage.FILESYSTEM_CONTEXT__ROOT, null, msgs); |
| msgs = basicSetRoot(newRoot, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FilesystemPackage.FILESYSTEM_CONTEXT__ROOT, newRoot, newRoot)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isClear() { |
| return clear; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setClear(boolean newClear) { |
| boolean oldClear = clear; |
| clear = newClear; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FilesystemPackage.FILESYSTEM_CONTEXT__CLEAR, oldClear, clear)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FilesystemPackage.FILESYSTEM_CONTEXT__ROOT: |
| return basicSetRoot(null, 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 FilesystemPackage.FILESYSTEM_CONTEXT__PATH: |
| return getPath(); |
| case FilesystemPackage.FILESYSTEM_CONTEXT__ROOT: |
| return getRoot(); |
| case FilesystemPackage.FILESYSTEM_CONTEXT__CLEAR: |
| return isClear(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FilesystemPackage.FILESYSTEM_CONTEXT__PATH: |
| setPath((String)newValue); |
| return; |
| case FilesystemPackage.FILESYSTEM_CONTEXT__ROOT: |
| setRoot((FSFolder)newValue); |
| return; |
| case FilesystemPackage.FILESYSTEM_CONTEXT__CLEAR: |
| setClear((Boolean)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FilesystemPackage.FILESYSTEM_CONTEXT__PATH: |
| setPath(PATH_EDEFAULT); |
| return; |
| case FilesystemPackage.FILESYSTEM_CONTEXT__ROOT: |
| setRoot((FSFolder)null); |
| return; |
| case FilesystemPackage.FILESYSTEM_CONTEXT__CLEAR: |
| setClear(CLEAR_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FilesystemPackage.FILESYSTEM_CONTEXT__PATH: |
| return PATH_EDEFAULT == null ? path != null : !PATH_EDEFAULT.equals(path); |
| case FilesystemPackage.FILESYSTEM_CONTEXT__ROOT: |
| return root != null; |
| case FilesystemPackage.FILESYSTEM_CONTEXT__CLEAR: |
| return clear != CLEAR_EDEFAULT; |
| } |
| 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(", clear: "); |
| result.append(clear); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //FilesystemContextImpl |