blob: f038fbe6eeef6cdcc61e67ad1458b8adc6d471dd [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.common.notify.NotificationChain;
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.PerspectivePart;
import org.eclipse.osbp.xtext.perspective.PerspectiveView;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Perspective Part</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.perspective.impl.PerspectivePartImpl#getIconURI <em>Icon URI</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.perspective.impl.PerspectivePartImpl#getView <em>View</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.perspective.impl.PerspectivePartImpl#isIsClosable <em>Is Closable</em>}</li>
* </ul>
*
* @generated
*/
public class PerspectivePartImpl extends PerspectiveElementImpl implements PerspectivePart {
/**
* The default value of the '{@link #getIconURI() <em>Icon URI</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIconURI()
* @generated
* @ordered
*/
protected static final String ICON_URI_EDEFAULT = null;
/**
* The cached value of the '{@link #getIconURI() <em>Icon URI</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIconURI()
* @generated
* @ordered
*/
protected String iconURI = ICON_URI_EDEFAULT;
/**
* The cached value of the '{@link #getView() <em>View</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getView()
* @generated
* @ordered
*/
protected PerspectiveView view;
/**
* The default value of the '{@link #isIsClosable() <em>Is Closable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsClosable()
* @generated
* @ordered
*/
protected static final boolean IS_CLOSABLE_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsClosable() <em>Is Closable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsClosable()
* @generated
* @ordered
*/
protected boolean isClosable = IS_CLOSABLE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PerspectivePartImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PerspectiveDslPackage.Literals.PERSPECTIVE_PART;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getIconURI() {
return iconURI;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIconURI(String newIconURI) {
String oldIconURI = iconURI;
iconURI = newIconURI;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PerspectiveDslPackage.PERSPECTIVE_PART__ICON_URI, oldIconURI, iconURI));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PerspectiveView getView() {
return view;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetView(PerspectiveView newView, NotificationChain msgs) {
PerspectiveView oldView = view;
view = newView;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PerspectiveDslPackage.PERSPECTIVE_PART__VIEW, oldView, newView);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setView(PerspectiveView newView) {
if (newView != view) {
NotificationChain msgs = null;
if (view != null)
msgs = ((InternalEObject)view).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PerspectiveDslPackage.PERSPECTIVE_PART__VIEW, null, msgs);
if (newView != null)
msgs = ((InternalEObject)newView).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PerspectiveDslPackage.PERSPECTIVE_PART__VIEW, null, msgs);
msgs = basicSetView(newView, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PerspectiveDslPackage.PERSPECTIVE_PART__VIEW, newView, newView));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isIsClosable() {
return isClosable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsClosable(boolean newIsClosable) {
boolean oldIsClosable = isClosable;
isClosable = newIsClosable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PerspectiveDslPackage.PERSPECTIVE_PART__IS_CLOSABLE, oldIsClosable, isClosable));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PerspectiveDslPackage.PERSPECTIVE_PART__VIEW:
return basicSetView(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 PerspectiveDslPackage.PERSPECTIVE_PART__ICON_URI:
return getIconURI();
case PerspectiveDslPackage.PERSPECTIVE_PART__VIEW:
return getView();
case PerspectiveDslPackage.PERSPECTIVE_PART__IS_CLOSABLE:
return isIsClosable();
}
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_PART__ICON_URI:
setIconURI((String)newValue);
return;
case PerspectiveDslPackage.PERSPECTIVE_PART__VIEW:
setView((PerspectiveView)newValue);
return;
case PerspectiveDslPackage.PERSPECTIVE_PART__IS_CLOSABLE:
setIsClosable((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PerspectiveDslPackage.PERSPECTIVE_PART__ICON_URI:
setIconURI(ICON_URI_EDEFAULT);
return;
case PerspectiveDslPackage.PERSPECTIVE_PART__VIEW:
setView((PerspectiveView)null);
return;
case PerspectiveDslPackage.PERSPECTIVE_PART__IS_CLOSABLE:
setIsClosable(IS_CLOSABLE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PerspectiveDslPackage.PERSPECTIVE_PART__ICON_URI:
return ICON_URI_EDEFAULT == null ? iconURI != null : !ICON_URI_EDEFAULT.equals(iconURI);
case PerspectiveDslPackage.PERSPECTIVE_PART__VIEW:
return view != null;
case PerspectiveDslPackage.PERSPECTIVE_PART__IS_CLOSABLE:
return isClosable != IS_CLOSABLE_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(" (iconURI: ");
result.append(iconURI);
result.append(", isClosable: ");
result.append(isClosable);
result.append(')');
return result.toString();
}
} //PerspectivePartImpl