| /** |
| * 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.MenuCategory; |
| import org.eclipse.osbp.xtext.menu.MenuDslPackage; |
| import org.eclipse.osbp.xtext.menu.MenuPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Menu Package</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.menu.impl.MenuPackageImpl#getCategories <em>Categories</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.menu.impl.MenuPackageImpl#getExpandedImage <em>Expanded Image</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.menu.impl.MenuPackageImpl#getCollapsedImage <em>Collapsed Image</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.menu.impl.MenuPackageImpl#getWidth <em>Width</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.menu.impl.MenuPackageImpl#getHeight <em>Height</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.menu.impl.MenuPackageImpl#isHasDesigner <em>Has Designer</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MenuPackageImpl extends LPackageImpl implements MenuPackage { |
| /** |
| * The cached value of the '{@link #getCategories() <em>Categories</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCategories() |
| * @generated |
| * @ordered |
| */ |
| protected EList<MenuCategory> categories; |
| |
| /** |
| * The default value of the '{@link #getExpandedImage() <em>Expanded Image</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getExpandedImage() |
| * @generated |
| * @ordered |
| */ |
| protected static final String EXPANDED_IMAGE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getExpandedImage() <em>Expanded Image</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getExpandedImage() |
| * @generated |
| * @ordered |
| */ |
| protected String expandedImage = EXPANDED_IMAGE_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getCollapsedImage() <em>Collapsed Image</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCollapsedImage() |
| * @generated |
| * @ordered |
| */ |
| protected static final String COLLAPSED_IMAGE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getCollapsedImage() <em>Collapsed Image</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCollapsedImage() |
| * @generated |
| * @ordered |
| */ |
| protected String collapsedImage = COLLAPSED_IMAGE_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getWidth() <em>Width</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getWidth() |
| * @generated |
| * @ordered |
| */ |
| protected static final String WIDTH_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getWidth() <em>Width</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getWidth() |
| * @generated |
| * @ordered |
| */ |
| protected String width = WIDTH_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getHeight() <em>Height</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getHeight() |
| * @generated |
| * @ordered |
| */ |
| protected static final String HEIGHT_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getHeight() <em>Height</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getHeight() |
| * @generated |
| * @ordered |
| */ |
| protected String height = HEIGHT_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #isHasDesigner() <em>Has Designer</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isHasDesigner() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean HAS_DESIGNER_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isHasDesigner() <em>Has Designer</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isHasDesigner() |
| * @generated |
| * @ordered |
| */ |
| protected boolean hasDesigner = HAS_DESIGNER_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MenuPackageImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return MenuDslPackage.Literals.MENU_PACKAGE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<MenuCategory> getCategories() { |
| if (categories == null) { |
| categories = new EObjectContainmentEList<MenuCategory>(MenuCategory.class, this, MenuDslPackage.MENU_PACKAGE__CATEGORIES); |
| } |
| return categories; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getExpandedImage() { |
| return expandedImage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setExpandedImage(String newExpandedImage) { |
| String oldExpandedImage = expandedImage; |
| expandedImage = newExpandedImage; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MenuDslPackage.MENU_PACKAGE__EXPANDED_IMAGE, oldExpandedImage, expandedImage)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getCollapsedImage() { |
| return collapsedImage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setCollapsedImage(String newCollapsedImage) { |
| String oldCollapsedImage = collapsedImage; |
| collapsedImage = newCollapsedImage; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MenuDslPackage.MENU_PACKAGE__COLLAPSED_IMAGE, oldCollapsedImage, collapsedImage)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getWidth() { |
| return width; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setWidth(String newWidth) { |
| String oldWidth = width; |
| width = newWidth; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MenuDslPackage.MENU_PACKAGE__WIDTH, oldWidth, width)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getHeight() { |
| return height; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setHeight(String newHeight) { |
| String oldHeight = height; |
| height = newHeight; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MenuDslPackage.MENU_PACKAGE__HEIGHT, oldHeight, height)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isHasDesigner() { |
| return hasDesigner; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setHasDesigner(boolean newHasDesigner) { |
| boolean oldHasDesigner = hasDesigner; |
| hasDesigner = newHasDesigner; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MenuDslPackage.MENU_PACKAGE__HAS_DESIGNER, oldHasDesigner, hasDesigner)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case MenuDslPackage.MENU_PACKAGE__CATEGORIES: |
| return ((InternalEList<?>)getCategories()).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_PACKAGE__CATEGORIES: |
| return getCategories(); |
| case MenuDslPackage.MENU_PACKAGE__EXPANDED_IMAGE: |
| return getExpandedImage(); |
| case MenuDslPackage.MENU_PACKAGE__COLLAPSED_IMAGE: |
| return getCollapsedImage(); |
| case MenuDslPackage.MENU_PACKAGE__WIDTH: |
| return getWidth(); |
| case MenuDslPackage.MENU_PACKAGE__HEIGHT: |
| return getHeight(); |
| case MenuDslPackage.MENU_PACKAGE__HAS_DESIGNER: |
| return isHasDesigner(); |
| } |
| 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_PACKAGE__CATEGORIES: |
| getCategories().clear(); |
| getCategories().addAll((Collection<? extends MenuCategory>)newValue); |
| return; |
| case MenuDslPackage.MENU_PACKAGE__EXPANDED_IMAGE: |
| setExpandedImage((String)newValue); |
| return; |
| case MenuDslPackage.MENU_PACKAGE__COLLAPSED_IMAGE: |
| setCollapsedImage((String)newValue); |
| return; |
| case MenuDslPackage.MENU_PACKAGE__WIDTH: |
| setWidth((String)newValue); |
| return; |
| case MenuDslPackage.MENU_PACKAGE__HEIGHT: |
| setHeight((String)newValue); |
| return; |
| case MenuDslPackage.MENU_PACKAGE__HAS_DESIGNER: |
| setHasDesigner((Boolean)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case MenuDslPackage.MENU_PACKAGE__CATEGORIES: |
| getCategories().clear(); |
| return; |
| case MenuDslPackage.MENU_PACKAGE__EXPANDED_IMAGE: |
| setExpandedImage(EXPANDED_IMAGE_EDEFAULT); |
| return; |
| case MenuDslPackage.MENU_PACKAGE__COLLAPSED_IMAGE: |
| setCollapsedImage(COLLAPSED_IMAGE_EDEFAULT); |
| return; |
| case MenuDslPackage.MENU_PACKAGE__WIDTH: |
| setWidth(WIDTH_EDEFAULT); |
| return; |
| case MenuDslPackage.MENU_PACKAGE__HEIGHT: |
| setHeight(HEIGHT_EDEFAULT); |
| return; |
| case MenuDslPackage.MENU_PACKAGE__HAS_DESIGNER: |
| setHasDesigner(HAS_DESIGNER_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case MenuDslPackage.MENU_PACKAGE__CATEGORIES: |
| return categories != null && !categories.isEmpty(); |
| case MenuDslPackage.MENU_PACKAGE__EXPANDED_IMAGE: |
| return EXPANDED_IMAGE_EDEFAULT == null ? expandedImage != null : !EXPANDED_IMAGE_EDEFAULT.equals(expandedImage); |
| case MenuDslPackage.MENU_PACKAGE__COLLAPSED_IMAGE: |
| return COLLAPSED_IMAGE_EDEFAULT == null ? collapsedImage != null : !COLLAPSED_IMAGE_EDEFAULT.equals(collapsedImage); |
| case MenuDslPackage.MENU_PACKAGE__WIDTH: |
| return WIDTH_EDEFAULT == null ? width != null : !WIDTH_EDEFAULT.equals(width); |
| case MenuDslPackage.MENU_PACKAGE__HEIGHT: |
| return HEIGHT_EDEFAULT == null ? height != null : !HEIGHT_EDEFAULT.equals(height); |
| case MenuDslPackage.MENU_PACKAGE__HAS_DESIGNER: |
| return hasDesigner != HAS_DESIGNER_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(" (expandedImage: "); |
| result.append(expandedImage); |
| result.append(", collapsedImage: "); |
| result.append(collapsedImage); |
| result.append(", width: "); |
| result.append(width); |
| result.append(", height: "); |
| result.append(height); |
| result.append(", hasDesigner: "); |
| result.append(hasDesigner); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //MenuPackageImpl |