| /**
|
| * *******************************************************************************
|
| * Copyright (c) 2009, 2019 Mia-Software and others.
|
| * All rights reserved. This program and the accompanying materials
|
| * are made available under the terms of the Eclipse Public License v2.0
|
| * which accompanies this distribution, and is available at
|
| * http://www.eclipse.org/legal/epl-v20.html
|
| *
|
| * Contributors:
|
| *
|
| * Fabien Giquel (Mia-Software) - initial API and implementation
|
| * Gregoire DUPE (Mia-Software) - initial API and implementation
|
| * *******************************************************************************
|
| *
|
| * $Id$
|
| */ |
| package org.eclipse.modisco.java.nousages.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.modisco.java.ImportDeclaration;
|
| import org.eclipse.modisco.java.NamedElement;
|
| import org.eclipse.modisco.java.nousages.meta.JavaPackage;
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * An implementation of the model object '<em><b>Import Declaration</b></em>'.
|
| * <!-- end-user-doc -->
|
| * <p>
|
| * The following features are implemented:
|
| * <ul>
|
| * <li>{@link org.eclipse.modisco.java.nousages.impl.ImportDeclarationImpl#isStatic <em>Static</em>}</li>
|
| * <li>{@link org.eclipse.modisco.java.nousages.impl.ImportDeclarationImpl#getImportedElement <em>Imported Element</em>}</li>
|
| * </ul>
|
| * </p>
|
| *
|
| * @generated
|
| */
|
| public class ImportDeclarationImpl extends ASTNodeImpl implements ImportDeclaration {
|
| /**
|
| * The default value of the '{@link #isStatic() <em>Static</em>}' attribute.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #isStatic()
|
| * @generated
|
| * @ordered
|
| */
|
| protected static final boolean STATIC_EDEFAULT = false;
|
|
|
| /**
|
| * The cached value of the '{@link #isStatic() <em>Static</em>}' attribute.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #isStatic()
|
| * @generated
|
| * @ordered
|
| */
|
| protected boolean static_ = STATIC_EDEFAULT;
|
|
|
| /**
|
| * The cached value of the '{@link #getImportedElement() <em>Imported Element</em>}' reference.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getImportedElement()
|
| * @generated
|
| * @ordered
|
| */
|
| protected NamedElement importedElement;
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| protected ImportDeclarationImpl() {
|
| super();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| protected EClass eStaticClass() {
|
| return JavaPackage.eINSTANCE.getImportDeclaration();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public boolean isStatic() {
|
| return static_;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public void setStatic(boolean newStatic) {
|
| boolean oldStatic = static_;
|
| static_ = newStatic;
|
| if (eNotificationRequired())
|
| eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.IMPORT_DECLARATION__STATIC, oldStatic, static_));
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public NamedElement getImportedElement() {
|
| if (importedElement != null && importedElement.eIsProxy()) {
|
| InternalEObject oldImportedElement = (InternalEObject)importedElement;
|
| importedElement = (NamedElement)eResolveProxy(oldImportedElement);
|
| if (importedElement != oldImportedElement) {
|
| if (eNotificationRequired())
|
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, JavaPackage.IMPORT_DECLARATION__IMPORTED_ELEMENT, oldImportedElement, importedElement));
|
| }
|
| }
|
| return importedElement;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public NamedElement basicGetImportedElement() {
|
| return importedElement;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public void setImportedElement(NamedElement newImportedElement) {
|
| NamedElement oldImportedElement = importedElement;
|
| importedElement = newImportedElement;
|
| if (eNotificationRequired())
|
| eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.IMPORT_DECLARATION__IMPORTED_ELEMENT, oldImportedElement, importedElement));
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public Object eGet(int featureID, boolean resolve, boolean coreType) {
|
| switch (featureID) {
|
| case JavaPackage.IMPORT_DECLARATION__STATIC:
|
| return isStatic();
|
| case JavaPackage.IMPORT_DECLARATION__IMPORTED_ELEMENT:
|
| if (resolve) return getImportedElement();
|
| return basicGetImportedElement();
|
| }
|
| return super.eGet(featureID, resolve, coreType);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public void eSet(int featureID, Object newValue) {
|
| switch (featureID) {
|
| case JavaPackage.IMPORT_DECLARATION__STATIC:
|
| setStatic((Boolean)newValue);
|
| return;
|
| case JavaPackage.IMPORT_DECLARATION__IMPORTED_ELEMENT:
|
| setImportedElement((NamedElement)newValue);
|
| return;
|
| }
|
| super.eSet(featureID, newValue);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public void eUnset(int featureID) {
|
| switch (featureID) {
|
| case JavaPackage.IMPORT_DECLARATION__STATIC:
|
| setStatic(STATIC_EDEFAULT);
|
| return;
|
| case JavaPackage.IMPORT_DECLARATION__IMPORTED_ELEMENT:
|
| setImportedElement((NamedElement)null);
|
| return;
|
| }
|
| super.eUnset(featureID);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public boolean eIsSet(int featureID) {
|
| switch (featureID) {
|
| case JavaPackage.IMPORT_DECLARATION__STATIC:
|
| return static_ != STATIC_EDEFAULT;
|
| case JavaPackage.IMPORT_DECLARATION__IMPORTED_ELEMENT:
|
| return importedElement != null;
|
| }
|
| 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(" (static: "); //$NON-NLS-1$
|
| result.append(static_);
|
| result.append(')');
|
| return result.toString();
|
| }
|
|
|
| } //ImportDeclarationImpl
|