blob: 2e959ea5002cef1390046d72b7159379a080f712 [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. 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
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Joerg Riegel - Initial implementation
*
*/
package org.eclipse.osbp.xtext.perspective.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.osbp.xtext.perspective.PerspectiveDslPackage;
import org.eclipse.osbp.xtext.perspective.PerspectiveElement;
import org.eclipse.osbp.xtext.perspective.PerspectiveSashContainer;
import org.eclipse.osbp.xtext.perspective.SashOrientation;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Perspective Sash Container</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.perspective.impl.PerspectiveSashContainerImpl#getOrientation <em>Orientation</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.perspective.impl.PerspectiveSashContainerImpl#getSelectedElement <em>Selected Element</em>}</li>
* </ul>
*
* @generated
*/
public class PerspectiveSashContainerImpl extends PerspectiveElementImpl implements PerspectiveSashContainer {
/**
* The default value of the '{@link #getOrientation() <em>Orientation</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOrientation()
* @generated
* @ordered
*/
protected static final SashOrientation ORIENTATION_EDEFAULT = SashOrientation.HORIZONTAL;
/**
* The cached value of the '{@link #getOrientation() <em>Orientation</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOrientation()
* @generated
* @ordered
*/
protected SashOrientation orientation = ORIENTATION_EDEFAULT;
/**
* The cached value of the '{@link #getSelectedElement() <em>Selected Element</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSelectedElement()
* @generated
* @ordered
*/
protected PerspectiveElement selectedElement;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PerspectiveSashContainerImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PerspectiveDslPackage.Literals.PERSPECTIVE_SASH_CONTAINER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SashOrientation getOrientation() {
return orientation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOrientation(SashOrientation newOrientation) {
SashOrientation oldOrientation = orientation;
orientation = newOrientation == null ? ORIENTATION_EDEFAULT : newOrientation;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PerspectiveDslPackage.PERSPECTIVE_SASH_CONTAINER__ORIENTATION, oldOrientation, orientation));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PerspectiveElement getSelectedElement() {
if (selectedElement != null && selectedElement.eIsProxy()) {
InternalEObject oldSelectedElement = (InternalEObject)selectedElement;
selectedElement = (PerspectiveElement)eResolveProxy(oldSelectedElement);
if (selectedElement != oldSelectedElement) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, PerspectiveDslPackage.PERSPECTIVE_SASH_CONTAINER__SELECTED_ELEMENT, oldSelectedElement, selectedElement));
}
}
return selectedElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PerspectiveElement basicGetSelectedElement() {
return selectedElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSelectedElement(PerspectiveElement newSelectedElement) {
PerspectiveElement oldSelectedElement = selectedElement;
selectedElement = newSelectedElement;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PerspectiveDslPackage.PERSPECTIVE_SASH_CONTAINER__SELECTED_ELEMENT, oldSelectedElement, selectedElement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PerspectiveDslPackage.PERSPECTIVE_SASH_CONTAINER__ORIENTATION:
return getOrientation();
case PerspectiveDslPackage.PERSPECTIVE_SASH_CONTAINER__SELECTED_ELEMENT:
if (resolve) return getSelectedElement();
return basicGetSelectedElement();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PerspectiveDslPackage.PERSPECTIVE_SASH_CONTAINER__ORIENTATION:
setOrientation((SashOrientation)newValue);
return;
case PerspectiveDslPackage.PERSPECTIVE_SASH_CONTAINER__SELECTED_ELEMENT:
setSelectedElement((PerspectiveElement)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PerspectiveDslPackage.PERSPECTIVE_SASH_CONTAINER__ORIENTATION:
setOrientation(ORIENTATION_EDEFAULT);
return;
case PerspectiveDslPackage.PERSPECTIVE_SASH_CONTAINER__SELECTED_ELEMENT:
setSelectedElement((PerspectiveElement)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PerspectiveDslPackage.PERSPECTIVE_SASH_CONTAINER__ORIENTATION:
return orientation != ORIENTATION_EDEFAULT;
case PerspectiveDslPackage.PERSPECTIVE_SASH_CONTAINER__SELECTED_ELEMENT:
return selectedElement != null;
}
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(" (orientation: ");
result.append(orientation);
result.append(')');
return result.toString();
}
} //PerspectiveSashContainerImpl