| 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 java.util.List; |
| 15 |
import java.util.Map; |
| 16 |
|
| 17 |
import org.w3c.dom.Element; |
| 18 |
import org.w3c.dom.Node; |
| 19 |
|
| 20 |
import org.eclipse.emf.common.notify.Notification; |
| 21 |
import org.eclipse.emf.common.notify.NotificationChain; |
| 22 |
import org.eclipse.emf.ecore.EClass; |
| 23 |
import org.eclipse.emf.ecore.EObject; |
| 24 |
import org.eclipse.emf.ecore.EReference; |
| 25 |
import org.eclipse.emf.ecore.InternalEObject; |
| 26 |
import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 27 |
import org.eclipse.xsd.XSDAnnotation; |
| 28 |
import org.eclipse.xsd.XSDComponent; |
| 29 |
import org.eclipse.xsd.XSDConcreteComponent; |
| 30 |
import org.eclipse.xsd.XSDDiagnosticSeverity; |
| 31 |
import org.eclipse.xsd.XSDFactory; |
| 32 |
import org.eclipse.xsd.XSDModelGroup; |
| 33 |
import org.eclipse.xsd.XSDModelGroupDefinition; |
| 34 |
import org.eclipse.xsd.XSDNamedComponent; |
| 35 |
import org.eclipse.xsd.XSDPackage; |
| 36 |
import org.eclipse.xsd.XSDParticle; |
| 37 |
import org.eclipse.xsd.XSDRedefine; |
| 38 |
import org.eclipse.xsd.XSDSchema; |
| 39 |
import org.eclipse.xsd.util.XSDConstants; |
| 40 |
|
| 41 |
|
| 42 |
/** |
| 43 |
* <!-- begin-user-doc --> |
| 44 |
* An implementation of the model object '<em><b>Model Group Definition</b></em>'. |
| 45 |
* <!-- end-user-doc --> |
| 46 |
* <p> |
| 47 |
* The following features are implemented: |
| 48 |
* </p> |
| 49 |
* <ul> |
| 50 |
* <li>{@link org.eclipse.xsd.impl.XSDModelGroupDefinitionImpl#isModelGroupDefinitionReference <em>Model Group Definition Reference</em>}</li> |
| 51 |
* <li>{@link org.eclipse.xsd.impl.XSDModelGroupDefinitionImpl#getAnnotation <em>Annotation</em>}</li> |
| 52 |
* <li>{@link org.eclipse.xsd.impl.XSDModelGroupDefinitionImpl#getModelGroup <em>Model Group</em>}</li> |
| 53 |
* <li>{@link org.eclipse.xsd.impl.XSDModelGroupDefinitionImpl#getResolvedModelGroupDefinition <em>Resolved Model Group Definition</em>}</li> |
| 54 |
* </ul> |
| 55 |
* |
| 56 |
* @generated |
| 57 |
*/ |
| 58 |
public class XSDModelGroupDefinitionImpl |
| 59 |
extends XSDRedefinableComponentImpl |
| 60 |
implements XSDModelGroupDefinition |
| 61 |
{ |
| 62 |
/** |
| 63 |
* The default value of the '{@link #isModelGroupDefinitionReference() <em>Model Group Definition Reference</em>}' attribute. |
| 64 |
* <!-- begin-user-doc --> |
| 65 |
* <!-- end-user-doc --> |
| 66 |
* @see #isModelGroupDefinitionReference() |
| 67 |
* @generated |
| 68 |
* @ordered |
| 69 |
*/ |
| 70 |
protected static final boolean MODEL_GROUP_DEFINITION_REFERENCE_EDEFAULT = false; |
| 71 |
|
| 72 |
/** |
| 73 |
* The cached value of the '{@link #getAnnotation() <em>Annotation</em>}' containment reference. |
| 74 |
* <!-- begin-user-doc --> |
| 75 |
* <!-- end-user-doc --> |
| 76 |
* @see #getAnnotation() |
| 77 |
* @generated |
| 78 |
* @ordered |
| 79 |
*/ |
| 80 |
protected XSDAnnotation annotation; |
| 81 |
|
| 82 |
/** |
| 83 |
* The cached value of the '{@link #getModelGroup() <em>Model Group</em>}' containment reference. |
| 84 |
* <!-- begin-user-doc --> |
| 85 |
* <!-- end-user-doc --> |
| 86 |
* @see #getModelGroup() |
| 87 |
* @generated |
| 88 |
* @ordered |
| 89 |
*/ |
| 90 |
protected XSDModelGroup modelGroup; |
| 91 |
|
| 92 |
/** |
| 93 |
* The cached value of the '{@link #getResolvedModelGroupDefinition() <em>Resolved Model Group Definition</em>}' reference. |
| 94 |
* <!-- begin-user-doc --> |
| 95 |
* <!-- end-user-doc --> |
| 96 |
* @see #getResolvedModelGroupDefinition() |
| 97 |
* @generated |
| 98 |
* @ordered |
| 99 |
*/ |
| 100 |
protected XSDModelGroupDefinition resolvedModelGroupDefinition; |
| 101 |
|
| 102 |
public static XSDModelGroupDefinition createModelGroupDefinition(Node node) |
| 103 |
{ |
| 104 |
if (XSDConstants.nodeType(node) == XSDConstants.GROUP_ELEMENT) |
| 105 |
{ |
| 106 |
XSDModelGroupDefinition xsdModelGroupDefinition = XSDFactory.eINSTANCE.createXSDModelGroupDefinition(); |
| 107 |
xsdModelGroupDefinition.setElement((Element)node); |
| 108 |
return xsdModelGroupDefinition; |
| 109 |
} |
| 110 |
|
| 111 |
return null; |
| 112 |
} |
| 113 |
|
| 114 |
protected int analysisState; |
| 115 |
|
| 116 |
/** |
| 117 |
* <!-- begin-user-doc --> |
| 118 |
* <!-- end-user-doc --> |
| 119 |
* @generated NOT |
| 120 |
*/ |
| 121 |
protected XSDModelGroupDefinitionImpl() |
| 122 |
{ |
| 123 |
super(); |
| 124 |
this.resolvedModelGroupDefinition = this; |
| 125 |
// this.setResolvedModelGroupDefinition = true; |
| 126 |
} |
| 127 |
|
| 128 |
/** |
| 129 |
* <!-- begin-user-doc --> |
| 130 |
* <!-- end-user-doc --> |
| 131 |
* @generated |
| 132 |
*/ |
| 133 |
@Override |
| 134 |
protected EClass eStaticClass() |
| 135 |
{ |
| 136 |
return XSDPackage.Literals.XSD_MODEL_GROUP_DEFINITION; |
| 137 |
} |
| 138 |
|
| 139 |
/** |
| 140 |
* <!-- begin-user-doc --> |
| 141 |
* <!-- end-user-doc --> |
| 142 |
* @generated modifiable |
| 143 |
*/ |
| 144 |
public Boolean getModelGroupDefinitionReference() |
| 145 |
{ |
| 146 |
return isModelGroupDefinitionReference() ? Boolean.TRUE : Boolean.FALSE; |
| 147 |
} |
| 148 |
|
| 149 |
@Override |
| 150 |
protected boolean isUpdatingDOM() |
| 151 |
{ |
| 152 |
return |
| 153 |
super.isUpdatingDOM() || |
| 154 |
getContainer() instanceof XSDConcreteComponentImpl && |
| 155 |
((XSDConcreteComponentImpl)getContainer()).isUpdatingDOM(); |
| 156 |
} |
| 157 |
|
| 158 |
@Override |
| 159 |
public Element createElement() |
| 160 |
{ |
| 161 |
Element newElement = createElement(XSDConstants.GROUP_ELEMENT); |
| 162 |
setElement(newElement); |
| 163 |
|
| 164 |
XSDModelGroup theModelGroup = getModelGroup(); |
| 165 |
if (theModelGroup != null) |
| 166 |
{ |
| 167 |
Element modelGroupElement = ((XSDConcreteComponentImpl)theModelGroup).createElement(); |
| 168 |
newElement.appendChild(modelGroupElement); |
| 169 |
} |
| 170 |
|
| 171 |
return newElement; |
| 172 |
} |
| 173 |
|
| 174 |
@Override |
| 175 |
protected void patch() |
| 176 |
{ |
| 177 |
analysisState = UNANALYZED; |
| 178 |
super.patch(); |
| 179 |
XSDModelGroupDefinition theResolvedModelGroupDefinition = getResolvedModelGroupDefinition(); |
| 180 |
|
| 181 |
if (theResolvedModelGroupDefinition != this && (forceResolve || theResolvedModelGroupDefinition.getContainer() == null)) |
| 182 |
{ |
| 183 |
XSDModelGroupDefinition newResolvedModelGroupDefinition = |
| 184 |
resolveModelGroupDefinition(theResolvedModelGroupDefinition.getTargetNamespace(), theResolvedModelGroupDefinition.getName()); |
| 185 |
if (forceResolve || newResolvedModelGroupDefinition.getContainer() != null) |
| 186 |
{ |
| 187 |
handleNewResolvedModelGroupDefinition(newResolvedModelGroupDefinition); |
| 188 |
} |
| 189 |
} |
| 190 |
} |
| 191 |
|
| 192 |
@Override |
| 193 |
protected void traverseToRootForAnalysis() |
| 194 |
{ |
| 195 |
analysisState = UNANALYZED; |
| 196 |
super.traverseToRootForAnalysis(); |
| 197 |
} |
| 198 |
|
| 199 |
@Override |
| 200 |
protected boolean analyze() |
| 201 |
{ |
| 202 |
switch (analysisState) |
| 203 |
{ |
| 204 |
case UNANALYZED: |
| 205 |
{ |
| 206 |
analysisState = ANALYZING; |
| 207 |
super.analyze(); |
| 208 |
handleAnalysis(); |
| 209 |
if (analysisState == ANALYZING) |
| 210 |
{ |
| 211 |
analysisState = ANALYZED; |
| 212 |
return true; |
| 213 |
} |
| 214 |
else |
| 215 |
{ |
| 216 |
return false; |
| 217 |
} |
| 218 |
} |
| 219 |
case ANALYZED: |
| 220 |
{ |
| 221 |
return true; |
| 222 |
} |
| 223 |
case ANALYZING: |
| 224 |
case CIRCULAR: |
| 225 |
default: |
| 226 |
{ |
| 227 |
analysisState = CIRCULAR; |
| 228 |
return false; |
| 229 |
} |
| 230 |
} |
| 231 |
} |
| 232 |
|
| 233 |
protected void handleAnalysis() |
| 234 |
{ |
| 235 |
XSDModelGroupDefinition theResolvedModelGroupDefinition = getResolvedModelGroupDefinition(); |
| 236 |
if (theResolvedModelGroupDefinition != this && theResolvedModelGroupDefinition.getContainer() != null) |
| 237 |
{ |
| 238 |
((XSDConcreteComponentImpl)theResolvedModelGroupDefinition).analyze(); |
| 239 |
} |
| 240 |
} |
| 241 |
|
| 242 |
@Override |
| 243 |
public void validate() |
| 244 |
{ |
| 245 |
super.validate(); |
| 246 |
|
| 247 |
Element theElement = getElement(); |
| 248 |
if (theElement != null) |
| 249 |
{ |
| 250 |
if (getContainer() instanceof XSDSchema || getContainer() instanceof XSDRedefine) |
| 251 |
{ |
| 252 |
checkAttributes |
| 253 |
(XSDConstants.PART1, |
| 254 |
"element-group", |
| 255 |
theElement, |
| 256 |
new String [] |
| 257 |
{ |
| 258 |
XSDConstants.ID_ATTRIBUTE, |
| 259 |
XSDConstants.NAME_ATTRIBUTE |
| 260 |
}); |
| 261 |
|
| 262 |
checkComplexContent("namedGroup", XSDConstants.PART1, "element-group", theElement); |
| 263 |
} |
| 264 |
else |
| 265 |
{ |
| 266 |
checkAttributes |
| 267 |
(XSDConstants.PART1, |
| 268 |
"element-group", |
| 269 |
theElement, |
| 270 |
new String [] |
| 271 |
{ |
| 272 |
XSDConstants.ID_ATTRIBUTE, |
| 273 |
XSDConstants.MAXOCCURS_ATTRIBUTE, |
| 274 |
XSDConstants.MINOCCURS_ATTRIBUTE, |
| 275 |
XSDConstants.REF_ATTRIBUTE |
| 276 |
}); |
| 277 |
|
| 278 |
checkComplexContent("groupRef", XSDConstants.PART1, "element-group", theElement); |
| 279 |
} |
| 280 |
|
| 281 |
checkBuiltInTypeConstraint |
| 282 |
("ID", |
| 283 |
null, |
| 284 |
XSDConstants.PART1, |
| 285 |
"element-attributeGroup", |
| 286 |
theElement, |
| 287 |
XSDConstants.ID_ATTRIBUTE, |
| 288 |
false); |
| 289 |
} |
| 290 |
|
| 291 |
if (getContainer() instanceof XSDSchema || getContainer() instanceof XSDRedefine) |
| 292 |
{ |
| 293 |
if (isModelGroupDefinitionReference()) |
| 294 |
{ |
| 295 |
if (theElement == null) |
| 296 |
{ |
| 297 |
createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "cvc-complex-type.3", "ref"); |
| 298 |
} |
| 299 |
} |
| 300 |
else |
| 301 |
{ |
| 302 |
checkBuiltInTypeConstraint |
| 303 |
("NCName", |
| 304 |
getName(), |
| 305 |
XSDConstants.PART1, |
| 306 |
"element-group", |
| 307 |
theElement, |
| 308 |
XSDConstants.NAME_ATTRIBUTE, |
| 309 |
true); |
| 310 |
|
| 311 |
if (isCircular()) |
| 312 |
{ |
| 313 |
createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "coss-modelGroup.2"); |
| 314 |
} |
| 315 |
|
| 316 |
if (getModelGroup() != null) |
| 317 |
{ |
| 318 |
((XSDModelGroupImpl)getModelGroup()).validateRoot(); |
| 319 |
} |
| 320 |
} |
| 321 |
} |
| 322 |
else |
| 323 |
{ |
| 324 |
if (isModelGroupDefinitionReference()) |
| 325 |
{ |
| 326 |
XSDModelGroupDefinition theResolvedModelGroupDefinition = getResolvedModelGroupDefinition(); |
| 327 |
if (theResolvedModelGroupDefinition.getContainer() == null) |
| 328 |
{ |
| 329 |
createDiagnostic |
| 330 |
(XSDDiagnosticSeverity.ERROR_LITERAL, "_UI_UnresolvedModelGroupDefinition_message", theResolvedModelGroupDefinition.getURI()); |
| 331 |
} |
| 332 |
} |
| 333 |
else |
| 334 |
{ |
| 335 |
if (theElement == null) |
| 336 |
{ |
| 337 |
createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "cvc-complex-type.3", "name"); |
| 338 |
} |
| 339 |
} |
| 340 |
} |
| 341 |
} |
| 342 |
|
| 343 |
@Override |
| 344 |
protected void patchTargetNamespaceAttribute(XSDSchema xsdSchema) |
| 345 |
{ |
| 346 |
if (!isModelGroupDefinitionReference()) |
| 347 |
{ |
| 348 |
super.patchTargetNamespaceAttribute(xsdSchema); |
| 349 |
} |
| 350 |
} |
| 351 |
|
| 352 |
@Override |
| 353 |
protected void reconcileAttributes(Element changedElement) |
| 354 |
{ |
| 355 |
super.reconcileAttributes(changedElement); |
| 356 |
|
| 357 |
XSDModelGroupDefinition newResolvedModelGroupDefinition = this; |
| 358 |
if (changedElement.hasAttributeNS(null, XSDConstants.REF_ATTRIBUTE)) |
| 359 |
{ |
| 360 |
newResolvedModelGroupDefinition = |
| 361 |
resolveModelGroupDefinitionURI(XSDConstants.lookupQNameForAttribute(changedElement, XSDConstants.REF_ATTRIBUTE)); |
| 362 |
} |
| 363 |
|
| 364 |
handleNewResolvedModelGroupDefinition(newResolvedModelGroupDefinition); |
| 365 |
} |
| 366 |
|
| 367 |
protected void handleNewResolvedModelGroupDefinition(XSDModelGroupDefinition newResolvedModelGroupDefinition) |
| 368 |
{ |
| 369 |
if (eContainer != null) |
| 370 |
{ |
| 371 |
EObject parent = eContainer.eContainer(); |
| 372 |
if (parent != null) |
| 373 |
{ |
| 374 |
parent = parent.eContainer(); |
| 375 |
if (parent != null) |
| 376 |
{ |
| 377 |
parent = parent.eContainer(); |
| 378 |
if (parent instanceof XSDRedefine) |
| 379 |
{ |
| 380 |
XSDSchema redefinedSchema = ((XSDRedefine)parent).getIncorporatedSchema(); |
| 381 |
if (redefinedSchema != null) |
| 382 |
{ |
| 383 |
Map<XSDComponent, XSDComponent> redefinitionMap = ((XSDSchemaImpl)redefinedSchema).getRedefinitionMap(); |
| 384 |
if (redefinitionMap.containsKey(newResolvedModelGroupDefinition)) |
| 385 |
{ |
| 386 |
XSDComponent replacement = redefinitionMap.get(newResolvedModelGroupDefinition); |
| 387 |
if (replacement != null) |
| 388 |
{ |
| 389 |
newResolvedModelGroupDefinition = (XSDModelGroupDefinition)replacement; |
| 390 |
} |
| 391 |
} |
| 392 |
} |
| 393 |
} |
| 394 |
} |
| 395 |
} |
| 396 |
} |
| 397 |
if (newResolvedModelGroupDefinition != getResolvedModelGroupDefinition()) |
| 398 |
{ |
| 399 |
setResolvedModelGroupDefinition(newResolvedModelGroupDefinition); |
| 400 |
if (getContainer() instanceof XSDParticle) |
| 401 |
{ |
| 402 |
((XSDParticle)getContainer()).setTerm(newResolvedModelGroupDefinition.getModelGroup()); |
| 403 |
} |
| 404 |
} |
| 405 |
} |
| 406 |
|
| 407 |
@Override |
| 408 |
protected void handleUnreconciledElement(Element child, List<XSDConcreteComponent> newContents, List<XSDConcreteComponent> remainingContents) |
| 409 |
{ |
| 410 |
XSDAnnotation xsdAnnotation = XSDAnnotationImpl.createAnnotation(child); |
| 411 |
if (xsdAnnotation != null) |
| 412 |
{ |
| 413 |
if (newContents.isEmpty()) |
| 414 |
{ |
| 415 |
newContents.add(xsdAnnotation); |
| 416 |
} |
| 417 |
} |
| 418 |
else |
| 419 |
{ |
| 420 |
XSDModelGroup xsdModelGroup = XSDModelGroupImpl.createModelGroup(child); |
| 421 |
if (xsdModelGroup != null) |
| 422 |
{ |
| 423 |
newContents.add(xsdModelGroup); |
| 424 |
} |
| 425 |
} |
| 426 |
} |
| 427 |
|
| 428 |
@Override |
| 429 |
protected void handleReconciliation(List<XSDConcreteComponent> newContents, List<XSDConcreteComponent> remainingContents) |
| 430 |
{ |
| 431 |
handleAnnotationReconciliation(XSDPackage.Literals.XSD_MODEL_GROUP_DEFINITION__ANNOTATION, newContents, remainingContents); |
| 432 |
|
| 433 |
if (remainingContents.remove(getModelGroup())) |
| 434 |
{ |
| 435 |
setModelGroup(null); |
| 436 |
} |
| 437 |
|
| 438 |
if (!newContents.isEmpty()) |
| 439 |
{ |
| 440 |
setModelGroup((XSDModelGroup)newContents.get(0)); |
| 441 |
} |
| 442 |
} |
| 443 |
|
| 444 |
@Override |
| 445 |
protected void changeReference(EReference eReference) |
| 446 |
{ |
| 447 |
super.changeReference(eReference); |
| 448 |
Element theElement = getElement(); |
| 449 |
if (theElement != null) |
| 450 |
{ |
| 451 |
if (eReference == null || eReference == XSDPackage.Literals.XSD_MODEL_GROUP_DEFINITION__RESOLVED_MODEL_GROUP_DEFINITION) |
| 452 |
{ |
| 453 |
XSDModelGroupDefinition theResolvedModelGroupDefinition = getResolvedModelGroupDefinition(); |
| 454 |
if (theResolvedModelGroupDefinition != this) |
| 455 |
{ |
| 456 |
niceSetAttributeURIValue(theElement, XSDConstants.REF_ATTRIBUTE, theResolvedModelGroupDefinition.getURI()); |
| 457 |
|
| 458 |
if (eReference != null && getContainer() instanceof XSDParticle) |
| 459 |
{ |
| 460 |
((XSDParticle)getContainer()).setTerm(theResolvedModelGroupDefinition.getModelGroup()); |
| 461 |
} |
| 462 |
} |
| 463 |
} |
| 464 |
} |
| 465 |
} |
| 466 |
|
| 467 |
@Override |
| 468 |
protected void adoptContent(EReference eReference, XSDConcreteComponent xsdConcreteComponent) |
| 469 |
{ |
| 470 |
super.adoptContent(eReference, xsdConcreteComponent); |
| 471 |
if (eReference == XSDPackage.Literals.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP) |
| 472 |
{ |
| 473 |
traverseToRootForPatching(); |
| 474 |
} |
| 475 |
} |
| 476 |
|
| 477 |
@Override |
| 478 |
protected void orphanContent(EReference eReference, XSDConcreteComponent xsdConcreteComponent) |
| 479 |
{ |
| 480 |
super.orphanContent(eReference, xsdConcreteComponent); |
| 481 |
if (eReference == XSDPackage.Literals.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP) |
| 482 |
{ |
| 483 |
traverseToRootForPatching(); |
| 484 |
} |
| 485 |
} |
| 486 |
|
| 487 |
public boolean isModelGroupDefinitionReference() |
| 488 |
{ |
| 489 |
return this != getResolvedModelGroupDefinition(); |
| 490 |
} |
| 491 |
|
| 492 |
/** |
| 493 |
* <!-- begin-user-doc --> |
| 494 |
* <!-- end-user-doc --> |
| 495 |
* @generated |
| 496 |
*/ |
| 497 |
@Override |
| 498 |
public XSDAnnotation getAnnotation() |
| 499 |
{ |
| 500 |
return annotation; |
| 501 |
} |
| 502 |
|
| 503 |
/** |
| 504 |
* <!-- begin-user-doc --> |
| 505 |
* <!-- end-user-doc --> |
| 506 |
* @generated |
| 507 |
*/ |
| 508 |
@Override |
| 509 |
public void setAnnotation(XSDAnnotation newAnnotation) |
| 510 |
{ |
| 511 |
if (newAnnotation != annotation) |
| 512 |
{ |
| 513 |
NotificationChain msgs = null; |
| 514 |
if (annotation != null) |
| 515 |
msgs = ((InternalEObject)annotation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XSDPackage.XSD_MODEL_GROUP_DEFINITION__ANNOTATION, null, msgs); |
| 516 |
if (newAnnotation != null) |
| 517 |
msgs = ((InternalEObject)newAnnotation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XSDPackage.XSD_MODEL_GROUP_DEFINITION__ANNOTATION, null, msgs); |
| 518 |
msgs = basicSetAnnotation(newAnnotation, msgs); |
| 519 |
if (msgs != null) msgs.dispatch(); |
| 520 |
} |
| 521 |
else if (eNotificationRequired()) |
| 522 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_MODEL_GROUP_DEFINITION__ANNOTATION, newAnnotation, newAnnotation)); |
| 523 |
} |
| 524 |
|
| 525 |
/** |
| 526 |
* <!-- begin-user-doc --> |
| 527 |
* <!-- end-user-doc --> |
| 528 |
* @generated |
| 529 |
*/ |
| 530 |
public NotificationChain basicSetAnnotation(XSDAnnotation newAnnotation, NotificationChain msgs) |
| 531 |
{ |
| 532 |
XSDAnnotation oldAnnotation = annotation; |
| 533 |
annotation = newAnnotation; |
| 534 |
if (eNotificationRequired()) |
| 535 |
{ |
| 536 |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_MODEL_GROUP_DEFINITION__ANNOTATION, oldAnnotation, newAnnotation); |
| 537 |
if (msgs == null) msgs = notification; else msgs.add(notification); |
| 538 |
} |
| 539 |
return msgs; |
| 540 |
} |
| 541 |
|
| 542 |
/** |
| 543 |
* <!-- begin-user-doc --> |
| 544 |
* <!-- end-user-doc --> |
| 545 |
* @generated |
| 546 |
*/ |
| 547 |
@Override |
| 548 |
public XSDModelGroup getModelGroup() |
| 549 |
{ |
| 550 |
return modelGroup; |
| 551 |
} |
| 552 |
|
| 553 |
/** |
| 554 |
* <!-- begin-user-doc --> |
| 555 |
* <!-- end-user-doc --> |
| 556 |
* @generated |
| 557 |
*/ |
| 558 |
@Override |
| 559 |
public void setModelGroup(XSDModelGroup newModelGroup) |
| 560 |
{ |
| 561 |
if (newModelGroup != modelGroup) |
| 562 |
{ |
| 563 |
NotificationChain msgs = null; |
| 564 |
if (modelGroup != null) |
| 565 |
msgs = ((InternalEObject)modelGroup).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XSDPackage.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP, null, msgs); |
| 566 |
if (newModelGroup != null) |
| 567 |
msgs = ((InternalEObject)newModelGroup).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XSDPackage.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP, null, msgs); |
| 568 |
msgs = basicSetModelGroup(newModelGroup, msgs); |
| 569 |
if (msgs != null) msgs.dispatch(); |
| 570 |
} |
| 571 |
else if (eNotificationRequired()) |
| 572 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP, newModelGroup, newModelGroup)); |
| 573 |
} |
| 574 |
|
| 575 |
/** |
| 576 |
* <!-- begin-user-doc --> |
| 577 |
* <!-- end-user-doc --> |
| 578 |
* @generated |
| 579 |
*/ |
| 580 |
public NotificationChain basicSetModelGroup(XSDModelGroup newModelGroup, NotificationChain msgs) |
| 581 |
{ |
| 582 |
XSDModelGroup oldModelGroup = modelGroup; |
| 583 |
modelGroup = newModelGroup; |
| 584 |
if (eNotificationRequired()) |
| 585 |
{ |
| 586 |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP, oldModelGroup, newModelGroup); |
| 587 |
if (msgs == null) msgs = notification; else msgs.add(notification); |
| 588 |
} |
| 589 |
return msgs; |
| 590 |
} |
| 591 |
|
| 592 |
/** |
| 593 |
* <!-- begin-user-doc --> |
| 594 |
* <!-- end-user-doc --> |
| 595 |
* @generated |
| 596 |
*/ |
| 597 |
@Override |
| 598 |
public XSDModelGroupDefinition getResolvedModelGroupDefinition() |
| 599 |
{ |
| 600 |
return resolvedModelGroupDefinition; |
| 601 |
} |
| 602 |
|
| 603 |
/** |
| 604 |
* <!-- begin-user-doc --> |
| 605 |
* <!-- end-user-doc --> |
| 606 |
* @generated |
| 607 |
*/ |
| 608 |
@Override |
| 609 |
public void setResolvedModelGroupDefinition(XSDModelGroupDefinition newResolvedModelGroupDefinition) |
| 610 |
{ |
| 611 |
XSDModelGroupDefinition oldResolvedModelGroupDefinition = resolvedModelGroupDefinition; |
| 612 |
resolvedModelGroupDefinition = newResolvedModelGroupDefinition; |
| 613 |
if (eNotificationRequired()) |
| 614 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_MODEL_GROUP_DEFINITION__RESOLVED_MODEL_GROUP_DEFINITION, oldResolvedModelGroupDefinition, resolvedModelGroupDefinition)); |
| 615 |
} |
| 616 |
|
| 617 |
/** |
| 618 |
* <!-- begin-user-doc --> |
| 619 |
* <!-- end-user-doc --> |
| 620 |
* @generated |
| 621 |
*/ |
| 622 |
@Override |
| 623 |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| 624 |
{ |
| 625 |
switch (featureID) |
| 626 |
{ |
| 627 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__ANNOTATION: |
| 628 |
return basicSetAnnotation(null, msgs); |
| 629 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP: |
| 630 |
return basicSetModelGroup(null, msgs); |
| 631 |
} |
| 632 |
return super.eInverseRemove(otherEnd, featureID, msgs); |
| 633 |
} |
| 634 |
|
| 635 |
/** |
| 636 |
* <!-- begin-user-doc --> |
| 637 |
* <!-- end-user-doc --> |
| 638 |
* @generated |
| 639 |
*/ |
| 640 |
@Override |
| 641 |
public Object eGet(int featureID, boolean resolve, boolean coreType) |
| 642 |
{ |
| 643 |
switch (featureID) |
| 644 |
{ |
| 645 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP_DEFINITION_REFERENCE: |
| 646 |
return isModelGroupDefinitionReference(); |
| 647 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__ANNOTATION: |
| 648 |
return getAnnotation(); |
| 649 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP: |
| 650 |
return getModelGroup(); |
| 651 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__RESOLVED_MODEL_GROUP_DEFINITION: |
| 652 |
return getResolvedModelGroupDefinition(); |
| 653 |
} |
| 654 |
return super.eGet(featureID, resolve, coreType); |
| 655 |
} |
| 656 |
|
| 657 |
/** |
| 658 |
* <!-- begin-user-doc --> |
| 659 |
* <!-- end-user-doc --> |
| 660 |
* @generated |
| 661 |
*/ |
| 662 |
@Override |
| 663 |
public void eSet(int featureID, Object newValue) |
| 664 |
{ |
| 665 |
switch (featureID) |
| 666 |
{ |
| 667 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__ANNOTATION: |
| 668 |
setAnnotation((XSDAnnotation)newValue); |
| 669 |
return; |
| 670 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP: |
| 671 |
setModelGroup((XSDModelGroup)newValue); |
| 672 |
return; |
| 673 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__RESOLVED_MODEL_GROUP_DEFINITION: |
| 674 |
setResolvedModelGroupDefinition((XSDModelGroupDefinition)newValue); |
| 675 |
return; |
| 676 |
} |
| 677 |
super.eSet(featureID, newValue); |
| 678 |
} |
| 679 |
|
| 680 |
/** |
| 681 |
* <!-- begin-user-doc --> |
| 682 |
* <!-- end-user-doc --> |
| 683 |
* @generated |
| 684 |
*/ |
| 685 |
@Override |
| 686 |
public void eUnset(int featureID) |
| 687 |
{ |
| 688 |
switch (featureID) |
| 689 |
{ |
| 690 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__ANNOTATION: |
| 691 |
setAnnotation((XSDAnnotation)null); |
| 692 |
return; |
| 693 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP: |
| 694 |
setModelGroup((XSDModelGroup)null); |
| 695 |
return; |
| 696 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__RESOLVED_MODEL_GROUP_DEFINITION: |
| 697 |
setResolvedModelGroupDefinition((XSDModelGroupDefinition)null); |
| 698 |
return; |
| 699 |
} |
| 700 |
super.eUnset(featureID); |
| 701 |
} |
| 702 |
|
| 703 |
/** |
| 704 |
* <!-- begin-user-doc --> |
| 705 |
* <!-- end-user-doc --> |
| 706 |
* @generated |
| 707 |
*/ |
| 708 |
@Override |
| 709 |
public boolean eIsSet(int featureID) |
| 710 |
{ |
| 711 |
switch (featureID) |
| 712 |
{ |
| 713 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP_DEFINITION_REFERENCE: |
| 714 |
return isModelGroupDefinitionReference() != MODEL_GROUP_DEFINITION_REFERENCE_EDEFAULT; |
| 715 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__ANNOTATION: |
| 716 |
return annotation != null; |
| 717 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__MODEL_GROUP: |
| 718 |
return modelGroup != null; |
| 719 |
case XSDPackage.XSD_MODEL_GROUP_DEFINITION__RESOLVED_MODEL_GROUP_DEFINITION: |
| 720 |
return resolvedModelGroupDefinition != null; |
| 721 |
} |
| 722 |
return super.eIsSet(featureID); |
| 723 |
} |
| 724 |
|
| 725 |
@Override |
| 726 |
public String getQName() |
| 727 |
{ |
| 728 |
XSDModelGroupDefinition resolvedModelGroupDefinition = getResolvedModelGroupDefinition(); |
| 729 |
if (resolvedModelGroupDefinition == this) |
| 730 |
{ |
| 731 |
return super.getQName(); |
| 732 |
} |
| 733 |
else |
| 734 |
{ |
| 735 |
return resolvedModelGroupDefinition.getQName(this); |
| 736 |
} |
| 737 |
} |
| 738 |
|
| 739 |
@Override |
| 740 |
public boolean isNamedComponentReference() |
| 741 |
{ |
| 742 |
return isModelGroupDefinitionReference(); |
| 743 |
} |
| 744 |
|
| 745 |
@Override |
| 746 |
public XSDNamedComponent getResolvedNamedComponent() |
| 747 |
{ |
| 748 |
return getResolvedModelGroupDefinition(); |
| 749 |
} |
| 750 |
|
| 751 |
@Override |
| 752 |
public boolean isCircular() |
| 753 |
{ |
| 754 |
return analysisState == CIRCULAR; |
| 755 |
} |
| 756 |
|
| 757 |
@Override |
| 758 |
public XSDConcreteComponent cloneConcreteComponent(boolean deep, boolean shareDOM) |
| 759 |
{ |
| 760 |
XSDModelGroupDefinitionImpl clonedModelGroupDefinition = |
| 761 |
(XSDModelGroupDefinitionImpl)getXSDFactory().createXSDModelGroupDefinition(); |
| 762 |
clonedModelGroupDefinition.isReconciling = true; |
| 763 |
|
| 764 |
if (isModelGroupDefinitionReference()) |
| 765 |
{ |
| 766 |
XSDModelGroupDefinition theResolvedModelGroupDefinition = getResolvedModelGroupDefinition(); |
| 767 |
clonedModelGroupDefinition.setResolvedModelGroupDefinition |
| 768 |
(createUnresolvedModelGroupDefinition |
| 769 |
(theResolvedModelGroupDefinition.getTargetNamespace(), theResolvedModelGroupDefinition.getName())); |
| 770 |
} |
| 771 |
else |
| 772 |
{ |
| 773 |
if (getName() != null) |
| 774 |
{ |
| 775 |
clonedModelGroupDefinition.setName(getName()); |
| 776 |
} |
| 777 |
} |
| 778 |
|
| 779 |
if (deep) |
| 780 |
{ |
| 781 |
if (getAnnotation() != null) |
| 782 |
{ |
| 783 |
clonedModelGroupDefinition.setAnnotation((XSDAnnotation)getAnnotation().cloneConcreteComponent(deep, shareDOM)); |
| 784 |
} |
| 785 |
|
| 786 |
if (getModelGroup() != null) |
| 787 |
{ |
| 788 |
clonedModelGroupDefinition.setModelGroup((XSDModelGroup)getModelGroup().cloneConcreteComponent(deep, shareDOM)); |
| 789 |
} |
| 790 |
} |
| 791 |
|
| 792 |
if (shareDOM && getElement() != null) |
| 793 |
{ |
| 794 |
clonedModelGroupDefinition.setElement(getElement()); |
| 795 |
} |
| 796 |
|
| 797 |
clonedModelGroupDefinition.isReconciling = shareDOM; |
| 798 |
return clonedModelGroupDefinition; |
| 799 |
} |
| 800 |
} |
| 801 |
|