| /** |
| * <copyright> |
| * </copyright> |
| * |
| * $Id$ |
| */ |
| package org.eclipse.gmf.tooldef.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.emf.ecore.impl.EObjectImpl; |
| |
| import org.eclipse.gmf.tooldef.AbstractTool; |
| import org.eclipse.gmf.tooldef.GMFToolPackage; |
| import org.eclipse.gmf.tooldef.Image; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Abstract Tool</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.gmf.tooldef.impl.AbstractToolImpl#getSmallIcon <em>Small Icon</em>}</li> |
| * <li>{@link org.eclipse.gmf.tooldef.impl.AbstractToolImpl#getLargeIcon <em>Large Icon</em>}</li> |
| * <li>{@link org.eclipse.gmf.tooldef.impl.AbstractToolImpl#getTitle <em>Title</em>}</li> |
| * <li>{@link org.eclipse.gmf.tooldef.impl.AbstractToolImpl#getDescription <em>Description</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public abstract class AbstractToolImpl extends EObjectImpl implements AbstractTool { |
| /** |
| * The cached value of the '{@link #getSmallIcon() <em>Small Icon</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSmallIcon() |
| * @generated |
| * @ordered |
| */ |
| protected Image smallIcon = null; |
| |
| /** |
| * The cached value of the '{@link #getLargeIcon() <em>Large Icon</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLargeIcon() |
| * @generated |
| * @ordered |
| */ |
| protected Image largeIcon = null; |
| |
| /** |
| * The default value of the '{@link #getTitle() <em>Title</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTitle() |
| * @generated |
| * @ordered |
| */ |
| protected static final String TITLE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getTitle() <em>Title</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTitle() |
| * @generated |
| * @ordered |
| */ |
| protected String title = TITLE_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getDescription() <em>Description</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDescription() |
| * @generated |
| * @ordered |
| */ |
| protected static final String DESCRIPTION_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDescription() |
| * @generated |
| * @ordered |
| */ |
| protected String description = DESCRIPTION_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected AbstractToolImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return GMFToolPackage.eINSTANCE.getAbstractTool(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Image getSmallIcon() { |
| return smallIcon; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetSmallIcon(Image newSmallIcon, NotificationChain msgs) { |
| Image oldSmallIcon = smallIcon; |
| smallIcon = newSmallIcon; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GMFToolPackage.ABSTRACT_TOOL__SMALL_ICON, oldSmallIcon, newSmallIcon); |
| if (msgs == null) |
| msgs = notification; |
| else |
| msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSmallIcon(Image newSmallIcon) { |
| if (newSmallIcon != smallIcon) { |
| NotificationChain msgs = null; |
| if (smallIcon != null) |
| msgs = ((InternalEObject) smallIcon).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GMFToolPackage.ABSTRACT_TOOL__SMALL_ICON, null, msgs); |
| if (newSmallIcon != null) |
| msgs = ((InternalEObject) newSmallIcon).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GMFToolPackage.ABSTRACT_TOOL__SMALL_ICON, null, msgs); |
| msgs = basicSetSmallIcon(newSmallIcon, msgs); |
| if (msgs != null) |
| msgs.dispatch(); |
| } else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, GMFToolPackage.ABSTRACT_TOOL__SMALL_ICON, newSmallIcon, newSmallIcon)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Image getLargeIcon() { |
| return largeIcon; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetLargeIcon(Image newLargeIcon, NotificationChain msgs) { |
| Image oldLargeIcon = largeIcon; |
| largeIcon = newLargeIcon; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GMFToolPackage.ABSTRACT_TOOL__LARGE_ICON, oldLargeIcon, newLargeIcon); |
| if (msgs == null) |
| msgs = notification; |
| else |
| msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setLargeIcon(Image newLargeIcon) { |
| if (newLargeIcon != largeIcon) { |
| NotificationChain msgs = null; |
| if (largeIcon != null) |
| msgs = ((InternalEObject) largeIcon).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GMFToolPackage.ABSTRACT_TOOL__LARGE_ICON, null, msgs); |
| if (newLargeIcon != null) |
| msgs = ((InternalEObject) newLargeIcon).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GMFToolPackage.ABSTRACT_TOOL__LARGE_ICON, null, msgs); |
| msgs = basicSetLargeIcon(newLargeIcon, msgs); |
| if (msgs != null) |
| msgs.dispatch(); |
| } else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, GMFToolPackage.ABSTRACT_TOOL__LARGE_ICON, newLargeIcon, newLargeIcon)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getTitle() { |
| return title; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setTitle(String newTitle) { |
| String oldTitle = title; |
| title = newTitle; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, GMFToolPackage.ABSTRACT_TOOL__TITLE, oldTitle, title)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getDescription() { |
| return description; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDescription(String newDescription) { |
| String oldDescription = description; |
| description = newDescription; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, GMFToolPackage.ABSTRACT_TOOL__DESCRIPTION, oldDescription, description)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case GMFToolPackage.ABSTRACT_TOOL__SMALL_ICON: |
| return basicSetSmallIcon(null, msgs); |
| case GMFToolPackage.ABSTRACT_TOOL__LARGE_ICON: |
| return basicSetLargeIcon(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 GMFToolPackage.ABSTRACT_TOOL__SMALL_ICON: |
| return getSmallIcon(); |
| case GMFToolPackage.ABSTRACT_TOOL__LARGE_ICON: |
| return getLargeIcon(); |
| case GMFToolPackage.ABSTRACT_TOOL__TITLE: |
| return getTitle(); |
| case GMFToolPackage.ABSTRACT_TOOL__DESCRIPTION: |
| return getDescription(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case GMFToolPackage.ABSTRACT_TOOL__SMALL_ICON: |
| setSmallIcon((Image) newValue); |
| return; |
| case GMFToolPackage.ABSTRACT_TOOL__LARGE_ICON: |
| setLargeIcon((Image) newValue); |
| return; |
| case GMFToolPackage.ABSTRACT_TOOL__TITLE: |
| setTitle((String) newValue); |
| return; |
| case GMFToolPackage.ABSTRACT_TOOL__DESCRIPTION: |
| setDescription((String) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case GMFToolPackage.ABSTRACT_TOOL__SMALL_ICON: |
| setSmallIcon((Image) null); |
| return; |
| case GMFToolPackage.ABSTRACT_TOOL__LARGE_ICON: |
| setLargeIcon((Image) null); |
| return; |
| case GMFToolPackage.ABSTRACT_TOOL__TITLE: |
| setTitle(TITLE_EDEFAULT); |
| return; |
| case GMFToolPackage.ABSTRACT_TOOL__DESCRIPTION: |
| setDescription(DESCRIPTION_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case GMFToolPackage.ABSTRACT_TOOL__SMALL_ICON: |
| return smallIcon != null; |
| case GMFToolPackage.ABSTRACT_TOOL__LARGE_ICON: |
| return largeIcon != null; |
| case GMFToolPackage.ABSTRACT_TOOL__TITLE: |
| return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT.equals(title); |
| case GMFToolPackage.ABSTRACT_TOOL__DESCRIPTION: |
| return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); |
| } |
| 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(" (title: "); |
| result.append(title); |
| result.append(", description: "); |
| result.append(description); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //AbstractToolImpl |