blob: 49b06fc5f872b0cfa041c7ec4bee1f6993d714aa [file] [log] [blame]
/**
* Copyright (c) 2008 IBM Corporation 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*
* $Id$
*/
package org.eclipse.e4.ui.model.internal.application;
import org.eclipse.e4.ui.model.application.ApplicationPackage;
import org.eclipse.e4.ui.model.application.MItem;
import org.eclipse.e4.ui.model.application.MItemPart;
import org.eclipse.e4.ui.model.application.MPart;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>MItem Part</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.e4.ui.model.internal.application.MItemPartImpl#getIconURI <em>Icon URI</em>}</li>
* <li>{@link org.eclipse.e4.ui.model.internal.application.MItemPartImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.e4.ui.model.internal.application.MItemPartImpl#getTooltip <em>Tooltip</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class MItemPartImpl<P extends MPart<?>> extends MPartImpl<P> implements MItemPart<P> {
/**
* 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 default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #getTooltip() <em>Tooltip</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTooltip()
* @generated
* @ordered
*/
protected static final String TOOLTIP_EDEFAULT = null;
/**
* The cached value of the '{@link #getTooltip() <em>Tooltip</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTooltip()
* @generated
* @ordered
*/
protected String tooltip = TOOLTIP_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MItemPartImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ApplicationPackage.Literals.MITEM_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, ApplicationPackage.MITEM_PART__ICON_URI, oldIconURI, iconURI));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ApplicationPackage.MITEM_PART__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTooltip() {
return tooltip;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTooltip(String newTooltip) {
String oldTooltip = tooltip;
tooltip = newTooltip;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ApplicationPackage.MITEM_PART__TOOLTIP, oldTooltip, tooltip));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ApplicationPackage.MITEM_PART__ICON_URI:
return getIconURI();
case ApplicationPackage.MITEM_PART__NAME:
return getName();
case ApplicationPackage.MITEM_PART__TOOLTIP:
return getTooltip();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ApplicationPackage.MITEM_PART__ICON_URI:
setIconURI((String)newValue);
return;
case ApplicationPackage.MITEM_PART__NAME:
setName((String)newValue);
return;
case ApplicationPackage.MITEM_PART__TOOLTIP:
setTooltip((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ApplicationPackage.MITEM_PART__ICON_URI:
setIconURI(ICON_URI_EDEFAULT);
return;
case ApplicationPackage.MITEM_PART__NAME:
setName(NAME_EDEFAULT);
return;
case ApplicationPackage.MITEM_PART__TOOLTIP:
setTooltip(TOOLTIP_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ApplicationPackage.MITEM_PART__ICON_URI:
return ICON_URI_EDEFAULT == null ? iconURI != null : !ICON_URI_EDEFAULT.equals(iconURI);
case ApplicationPackage.MITEM_PART__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case ApplicationPackage.MITEM_PART__TOOLTIP:
return TOOLTIP_EDEFAULT == null ? tooltip != null : !TOOLTIP_EDEFAULT.equals(tooltip);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == MItem.class) {
switch (derivedFeatureID) {
case ApplicationPackage.MITEM_PART__ICON_URI: return ApplicationPackage.MITEM__ICON_URI;
case ApplicationPackage.MITEM_PART__NAME: return ApplicationPackage.MITEM__NAME;
case ApplicationPackage.MITEM_PART__TOOLTIP: return ApplicationPackage.MITEM__TOOLTIP;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
if (baseClass == MItem.class) {
switch (baseFeatureID) {
case ApplicationPackage.MITEM__ICON_URI: return ApplicationPackage.MITEM_PART__ICON_URI;
case ApplicationPackage.MITEM__NAME: return ApplicationPackage.MITEM_PART__NAME;
case ApplicationPackage.MITEM__TOOLTIP: return ApplicationPackage.MITEM_PART__TOOLTIP;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- 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: "); //$NON-NLS-1$
result.append(iconURI);
result.append(", name: "); //$NON-NLS-1$
result.append(name);
result.append(", tooltip: "); //$NON-NLS-1$
result.append(tooltip);
result.append(')');
return result.toString();
}
} //MItemPartImpl