/** * resolves any lazy cross references in this resource, adding Issues for unresolvable elements to this resource. * This resource might still contain resolvable proxies after this method has been called. * * @param mon a {@link CancelIndicator} can be used to stop the resolution. */ public void resolveLazyCrossReferences(final CancelIndicator mon) { final CancelIndicator monitor = mon == null ? CancelIndicator.NullImpl : mon; TreeIterator<Object> iterator = EcoreUtil.getAllContents(this, true); while (iterator.hasNext()) { operationCanceledManager.checkCanceled(monitor); InternalEObject source = (InternalEObject) iterator.next(); EStructuralFeature[] eStructuralFeatures = ((EClassImpl.FeatureSubsetSupplier) source.eClass() .getEAllStructuralFeatures()).crossReferences(); if (eStructuralFeatures != null) { for (EStructuralFeature crossRef : eStructuralFeatures) { operationCanceledManager.checkCanceled(monitor); resolveLazyCrossReference(source, crossRef); } } } }
/** * @since 2.6 */ public static Iterator<EObject> getNonDerivedContents(EObject eObject) { EClassImpl.FeatureSubsetSupplier featureSupplier = (EClassImpl.FeatureSubsetSupplier) eObject.eClass().getEAllStructuralFeatures(); EStructuralFeature[] eStructuralFeatures = featureSupplier.containments(); return (eStructuralFeatures == null ? EContentsEList.<EObject> emptyContentsEList() : new EContentsEList<EObject>(eObject, eStructuralFeatures) { @Override protected ListIterator<EObject> newResolvingListIterator() { return new ResolvingFeatureIteratorImpl<EObject>(eObject, eStructuralFeatures) { @Override protected boolean isIncluded(EStructuralFeature eStructuralFeature) { return !eStructuralFeature.isDerived(); } }; } }).iterator(); }
public void resolveLazyCrossReferences(CancelIndicator monitor) { TreeIterator<Object> iterator = EcoreUtil.getAllContents(this, true); while (iterator.hasNext()) { InternalEObject source = (InternalEObject) iterator.next(); EStructuralFeature[] eStructuralFeatures = ((EClassImpl.FeatureSubsetSupplier) source.eClass() .getEAllStructuralFeatures()).crossReferences(); if (eStructuralFeatures != null) { for (EStructuralFeature crossRef : eStructuralFeatures) { if (monitor.isCanceled()) { return; } resolveLazyCrossReference(source, crossRef, monitor); } } } }
private EList<EObject> eContentsWithOutFragments() { EStructuralFeature[] eStructuralFeatures = ((EClassImpl.FeatureSubsetSupplier) this.eClass().getEAllStructuralFeatures()).containments(); EStructuralFeature[] eStructuralFeaturesWithOutFragmentsArray = null; if (eStructuralFeatures != null) { List<EStructuralFeature> eStructuralFeaturesWithOutFragments = new ArrayList<EStructuralFeature>(eStructuralFeatures.length); for (EStructuralFeature eStructuralFeature : eStructuralFeatures) { FragmentationType fragmentationType = EMFFragUtil.getFragmentationType(eStructuralFeature); if (fragmentationType == FragmentationType.None || eStructuralFeature instanceof EAttribute) { eStructuralFeaturesWithOutFragments.add(eStructuralFeature); } } eStructuralFeaturesWithOutFragmentsArray = eStructuralFeaturesWithOutFragments .toArray(new EStructuralFeature[eStructuralFeaturesWithOutFragments.size()]); } EContentsEList<EObject> eContentsEListWithOutFragments = eStructuralFeaturesWithOutFragmentsArray == null ? EContentsEList .<EObject> emptyContentsEList() : new EContentsEList<EObject>(this, eStructuralFeaturesWithOutFragmentsArray); return eContentsEListWithOutFragments; }
private void replaceReferencesInGeneratedPackages(final List<EPackage> generatedPackages, final Map<EObject, EObject> eNamedElementMapping) { final TreeIterator<EObject> packageContentIterator = EcoreUtil.<EObject>getAllContents(generatedPackages); while (packageContentIterator.hasNext()) { { final EObject current = packageContentIterator.next(); EList<EStructuralFeature> _eAllStructuralFeatures = current.eClass().getEAllStructuralFeatures(); final EStructuralFeature[] crossReferenceFeatures = ((EClassImpl.FeatureSubsetSupplier) _eAllStructuralFeatures).crossReferences(); if ((crossReferenceFeatures != null)) { for (final EStructuralFeature crossReferenceFeature : crossReferenceFeatures) { boolean _isChangeable = crossReferenceFeature.isChangeable(); if (_isChangeable) { final EReference reference = ((EReference) crossReferenceFeature); boolean _isMany = reference.isMany(); if (_isMany) { Object _eGet = current.eGet(reference); final List<EObject> values = ((List<EObject>) _eGet); for (final EObject value : values) { boolean _containsKey = eNamedElementMapping.containsKey(value); if (_containsKey) { EcoreUtil.replace(current, reference, value, eNamedElementMapping.get(value)); } } } else { Object _eGet_1 = current.eGet(reference); final EObject value_1 = ((EObject) _eGet_1); boolean _containsKey_1 = eNamedElementMapping.containsKey(value_1); if (_containsKey_1) { EcoreUtil.replace(current, reference, value_1, eNamedElementMapping.get(value_1)); } } } } } } } }
/** * Creates a new {@code NeoEContentsEList} with the given {@code owner}. * * @param owner the owner of this list * @param <E> the type of elements in this list * * @return a new list */ public static <E> NeoEContentsEList<E> createNeoEContentsEList(EObject owner) { NeoEContentsEList<E> contentEList; EStructuralFeature[] features = ((EClassImpl.FeatureSubsetSupplier) owner.eClass().getEAllStructuralFeatures()).containments(); if (isNull(features)) { contentEList = NeoEContentsEList.emptyNeoContentsEList(); } else { contentEList = new NeoEContentsEList<>(owner, features); } return contentEList; }
public static <T> ECrossReferenceEList<T> createECrossReferenceEList(EObject eObject) { EStructuralFeature [] eStructuralFeatures = ((EClassImpl.FeatureSubsetSupplier)eObject.eClass().getEAllStructuralFeatures()).crossReferences(); return eStructuralFeatures == null ? ECrossReferenceEList.<T>emptyCrossReferenceEList() : new ECrossReferenceEList<T>(eObject, eStructuralFeatures); }
public static <T> EContentsEList<T> createEContentsEList(EObject eObject) { EStructuralFeature [] eStructuralFeatures = ((EClassImpl.FeatureSubsetSupplier)eObject.eClass().getEAllStructuralFeatures()).containments(); return eStructuralFeatures == null ? EContentsEList.<T>emptyContentsEList() : new EContentsEList<T>(eObject, eStructuralFeatures); }
public ECrossReferenceEList(EObject eObject) { super (eObject, ((EClassImpl.FeatureSubsetSupplier)eObject.eClass().getEAllStructuralFeatures()).crossReferences()); }
public FeatureIteratorImpl(EObject eObject) { this(eObject, ((EClassImpl.FeatureSubsetSupplier)eObject.eClass().getEAllStructuralFeatures()).crossReferences()); }
public EContentsEList(EObject eObject) { this.eObject = eObject; this.eStructuralFeatures = ((EClassImpl.FeatureSubsetSupplier)eObject.eClass().getEAllStructuralFeatures()).containments(); }