| /** |
| * Copyright (c) 2014,2016 Loetz GmbH&Co.KG (Heidelberg) |
| * 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 |
| * |
| * Contributors: |
| * Loetz GmbH&Co.KG - Initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.menu.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.osbp.dsl.semantic.common.types.impl.LPackageImpl; |
| |
| import org.eclipse.osbp.xtext.menu.MenuDslPackage; |
| import org.eclipse.osbp.xtext.menu.MenuEntry; |
| import org.eclipse.osbp.xtext.menu.MenuTree; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Menu Tree</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.menu.impl.MenuTreeImpl#isHasTooltip <em>Has Tooltip</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.menu.impl.MenuTreeImpl#getTooltip <em>Tooltip</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.menu.impl.MenuTreeImpl#getEntries <em>Entries</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MenuTreeImpl extends LPackageImpl implements MenuTree { |
| /** |
| * The default value of the '{@link #isHasTooltip() <em>Has Tooltip</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isHasTooltip() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean HAS_TOOLTIP_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isHasTooltip() <em>Has Tooltip</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isHasTooltip() |
| * @generated |
| * @ordered |
| */ |
| protected boolean hasTooltip = HAS_TOOLTIP_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; |
| |
| /** |
| * The cached value of the '{@link #getEntries() <em>Entries</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEntries() |
| * @generated |
| * @ordered |
| */ |
| protected EList<MenuEntry> entries; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MenuTreeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return MenuDslPackage.Literals.MENU_TREE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isHasTooltip() { |
| return hasTooltip; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setHasTooltip(boolean newHasTooltip) { |
| boolean oldHasTooltip = hasTooltip; |
| hasTooltip = newHasTooltip; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MenuDslPackage.MENU_TREE__HAS_TOOLTIP, oldHasTooltip, hasTooltip)); |
| } |
| |
| /** |
| * <!-- 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, MenuDslPackage.MENU_TREE__TOOLTIP, oldTooltip, tooltip)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<MenuEntry> getEntries() { |
| if (entries == null) { |
| entries = new EObjectContainmentEList<MenuEntry>(MenuEntry.class, this, MenuDslPackage.MENU_TREE__ENTRIES); |
| } |
| return entries; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case MenuDslPackage.MENU_TREE__ENTRIES: |
| return ((InternalEList<?>)getEntries()).basicRemove(otherEnd, 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 MenuDslPackage.MENU_TREE__HAS_TOOLTIP: |
| return isHasTooltip(); |
| case MenuDslPackage.MENU_TREE__TOOLTIP: |
| return getTooltip(); |
| case MenuDslPackage.MENU_TREE__ENTRIES: |
| return getEntries(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case MenuDslPackage.MENU_TREE__HAS_TOOLTIP: |
| setHasTooltip((Boolean)newValue); |
| return; |
| case MenuDslPackage.MENU_TREE__TOOLTIP: |
| setTooltip((String)newValue); |
| return; |
| case MenuDslPackage.MENU_TREE__ENTRIES: |
| getEntries().clear(); |
| getEntries().addAll((Collection<? extends MenuEntry>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case MenuDslPackage.MENU_TREE__HAS_TOOLTIP: |
| setHasTooltip(HAS_TOOLTIP_EDEFAULT); |
| return; |
| case MenuDslPackage.MENU_TREE__TOOLTIP: |
| setTooltip(TOOLTIP_EDEFAULT); |
| return; |
| case MenuDslPackage.MENU_TREE__ENTRIES: |
| getEntries().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case MenuDslPackage.MENU_TREE__HAS_TOOLTIP: |
| return hasTooltip != HAS_TOOLTIP_EDEFAULT; |
| case MenuDslPackage.MENU_TREE__TOOLTIP: |
| return TOOLTIP_EDEFAULT == null ? tooltip != null : !TOOLTIP_EDEFAULT.equals(tooltip); |
| case MenuDslPackage.MENU_TREE__ENTRIES: |
| return entries != null && !entries.isEmpty(); |
| } |
| 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(" (hasTooltip: "); |
| result.append(hasTooltip); |
| result.append(", tooltip: "); |
| result.append(tooltip); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //MenuTreeImpl |