| 1 |
/** |
| 2 |
* Copyright (c) 2002-2006 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v2.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v20.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* IBM - Initial API and implementation |
| 10 |
*/ |
| 11 |
package org.eclipse.xsd.impl; |
| 12 |
|
| 13 |
|
| 14 |
import org.eclipse.emf.common.notify.Notification; |
| 15 |
import org.eclipse.emf.ecore.EClass; |
| 16 |
import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 17 |
import org.eclipse.emf.ecore.util.EcoreUtil; |
| 18 |
|
| 19 |
import org.eclipse.xsd.XSDPackage; |
| 20 |
import org.eclipse.xsd.XSDSchema; |
| 21 |
import org.eclipse.xsd.XSDSchemaCompositor; |
| 22 |
|
| 23 |
|
| 24 |
/** |
| 25 |
* <!-- begin-user-doc --> |
| 26 |
* An implementation of the model object '<em><b>Schema Compositor</b></em>'. |
| 27 |
* <!-- end-user-doc --> |
| 28 |
* <p> |
| 29 |
* The following features are implemented: |
| 30 |
* </p> |
| 31 |
* <ul> |
| 32 |
* <li>{@link org.eclipse.xsd.impl.XSDSchemaCompositorImpl#getIncorporatedSchema <em>Incorporated Schema</em>}</li> |
| 33 |
* </ul> |
| 34 |
* |
| 35 |
* @generated |
| 36 |
*/ |
| 37 |
public abstract class XSDSchemaCompositorImpl |
| 38 |
extends XSDSchemaDirectiveImpl |
| 39 |
implements XSDSchemaCompositor |
| 40 |
{ |
| 41 |
/** |
| 42 |
* The cached value of the '{@link #getIncorporatedSchema() <em>Incorporated Schema</em>}' reference. |
| 43 |
* <!-- begin-user-doc --> |
| 44 |
* <!-- end-user-doc --> |
| 45 |
* @see #getIncorporatedSchema() |
| 46 |
* @generated |
| 47 |
* @ordered |
| 48 |
*/ |
| 49 |
protected XSDSchema incorporatedSchema; |
| 50 |
|
| 51 |
/** |
| 52 |
* <!-- begin-user-doc --> |
| 53 |
* <!-- end-user-doc --> |
| 54 |
* @generated |
| 55 |
*/ |
| 56 |
protected XSDSchemaCompositorImpl() |
| 57 |
{ |
| 58 |
super(); |
| 59 |
} |
| 60 |
|
| 61 |
@Override |
| 62 |
public void reset() |
| 63 |
{ |
| 64 |
super.reset(); |
| 65 |
if (incorporatedSchema != resolvedSchema && incorporatedSchema != null && incorporatedSchema.eContainer() != null) |
| 66 |
{ |
| 67 |
EcoreUtil.remove(incorporatedSchema); |
| 68 |
incorporatedSchema.reset(); |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* <!-- begin-user-doc --> |
| 74 |
* <!-- end-user-doc --> |
| 75 |
* @generated |
| 76 |
*/ |
| 77 |
@Override |
| 78 |
protected EClass eStaticClass() |
| 79 |
{ |
| 80 |
return XSDPackage.Literals.XSD_SCHEMA_COMPOSITOR; |
| 81 |
} |
| 82 |
|
| 83 |
/** |
| 84 |
* <!-- begin-user-doc --> |
| 85 |
* <!-- end-user-doc --> |
| 86 |
* @generated |
| 87 |
*/ |
| 88 |
@Override |
| 89 |
public XSDSchema getIncorporatedSchema() |
| 90 |
{ |
| 91 |
return incorporatedSchema; |
| 92 |
} |
| 93 |
|
| 94 |
/** |
| 95 |
* <!-- begin-user-doc --> |
| 96 |
* <!-- end-user-doc --> |
| 97 |
* @generated |
| 98 |
*/ |
| 99 |
@Override |
| 100 |
public void setIncorporatedSchema(XSDSchema newIncorporatedSchema) |
| 101 |
{ |
| 102 |
XSDSchema oldIncorporatedSchema = incorporatedSchema; |
| 103 |
incorporatedSchema = newIncorporatedSchema; |
| 104 |
if (eNotificationRequired()) |
| 105 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_SCHEMA_COMPOSITOR__INCORPORATED_SCHEMA, oldIncorporatedSchema, incorporatedSchema)); |
| 106 |
} |
| 107 |
|
| 108 |
/** |
| 109 |
* <!-- begin-user-doc --> |
| 110 |
* <!-- end-user-doc --> |
| 111 |
* @generated |
| 112 |
*/ |
| 113 |
@Override |
| 114 |
public Object eGet(int featureID, boolean resolve, boolean coreType) |
| 115 |
{ |
| 116 |
switch (featureID) |
| 117 |
{ |
| 118 |
case XSDPackage.XSD_SCHEMA_COMPOSITOR__INCORPORATED_SCHEMA: |
| 119 |
return getIncorporatedSchema(); |
| 120 |
} |
| 121 |
return super.eGet(featureID, resolve, coreType); |
| 122 |
} |
| 123 |
|
| 124 |
/** |
| 125 |
* <!-- begin-user-doc --> |
| 126 |
* <!-- end-user-doc --> |
| 127 |
* @generated |
| 128 |
*/ |
| 129 |
@Override |
| 130 |
public void eSet(int featureID, Object newValue) |
| 131 |
{ |
| 132 |
switch (featureID) |
| 133 |
{ |
| 134 |
case XSDPackage.XSD_SCHEMA_COMPOSITOR__INCORPORATED_SCHEMA: |
| 135 |
setIncorporatedSchema((XSDSchema)newValue); |
| 136 |
return; |
| 137 |
} |
| 138 |
super.eSet(featureID, newValue); |
| 139 |
} |
| 140 |
|
| 141 |
/** |
| 142 |
* <!-- begin-user-doc --> |
| 143 |
* <!-- end-user-doc --> |
| 144 |
* @generated |
| 145 |
*/ |
| 146 |
@Override |
| 147 |
public void eUnset(int featureID) |
| 148 |
{ |
| 149 |
switch (featureID) |
| 150 |
{ |
| 151 |
case XSDPackage.XSD_SCHEMA_COMPOSITOR__INCORPORATED_SCHEMA: |
| 152 |
setIncorporatedSchema((XSDSchema)null); |
| 153 |
return; |
| 154 |
} |
| 155 |
super.eUnset(featureID); |
| 156 |
} |
| 157 |
|
| 158 |
/** |
| 159 |
* <!-- begin-user-doc --> |
| 160 |
* <!-- end-user-doc --> |
| 161 |
* @generated |
| 162 |
*/ |
| 163 |
@Override |
| 164 |
public boolean eIsSet(int featureID) |
| 165 |
{ |
| 166 |
switch (featureID) |
| 167 |
{ |
| 168 |
case XSDPackage.XSD_SCHEMA_COMPOSITOR__INCORPORATED_SCHEMA: |
| 169 |
return incorporatedSchema != null; |
| 170 |
} |
| 171 |
return super.eIsSet(featureID); |
| 172 |
} |
| 173 |
|
| 174 |
} |