org.eclipse.emf.ecore.util.EContentsEList Java Examples

The following examples show how to use org.eclipse.emf.ecore.util.EContentsEList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EcoreUtil2.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @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();
}
 
Example #2
Source File: CrossDocumentContentAdapter.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void setTarget(EObject target) {
	super.setTarget(target);
	for (EContentsEList.FeatureIterator<EObject> featureIterator = (EContentsEList.FeatureIterator<EObject>) target
			.eCrossReferences().iterator(); featureIterator.hasNext();) {
		Notifier notifier = featureIterator.next();
		EStructuralFeature feature = featureIterator.feature();
		if (shouldAdapt(feature)) {
			addAdapter(notifier);
		}
	}
}
 
Example #3
Source File: CrossDocumentContentAdapter.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void unsetTarget(EObject target) {
	super.unsetTarget(target);
	for (EContentsEList.FeatureIterator<EObject> featureIterator = (EContentsEList.FeatureIterator<EObject>) target
			.eCrossReferences().iterator(); featureIterator.hasNext();) {
		Notifier notifier = featureIterator.next();
		EStructuralFeature feature = featureIterator.feature();
		if (shouldAdapt(feature)) {
			removeAdapter(notifier);
		}
	}
}
 
Example #4
Source File: InstanceImpl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public EList<EObject> eContents() {
    if (getType().getModel().isReflection()) {
        final EStructuralFeature[] features = ((EClassImpl.FeatureSubsetSupplier) getEClass()
                .getEAllStructuralFeatures()).containments();
        return new EContentsEList<EObject>(this, features);
    }
    return super.eContents();
}
 
Example #5
Source File: InstanceImpl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public EList<EObject> eCrossReferences() {
    if (getType().getModel().isReflection()) {
        final EStructuralFeature[] features = ((EClassImpl.FeatureSubsetSupplier) getEClass()
                .getEAllStructuralFeatures()).crossReferences();
        return new EContentsEList<EObject>(this, features);
    }
    return super.eCrossReferences();
}