Class NotLoadingResourceSet
- java.lang.Object
-
- org.eclipse.emf.common.notify.impl.BasicNotifierImpl
-
- org.eclipse.emf.common.notify.impl.NotifierImpl
-
- org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
-
- org.eclipse.emf.compare.ide.internal.utils.NotLoadingResourceSet
-
- All Implemented Interfaces:
Notifier
,DisposableResourceSet
,IProxyCreationListener
,ResourceSet
@Beta public final class NotLoadingResourceSet extends ResourceSetImpl implements DisposableResourceSet, IProxyCreationListener
This implementation of a resource set will be created from aStorageTraversal
, and only those resources that are part of the traversal will be loaded. This will allow us to resolve the proxies between these "traversed" resources.This resource set will prevent loading any resources that is not part of the initial traversal. The only exception to this rule is if one of the registered
ILoadOnDemandPolicy
says otherwise. Users should not try to add more resources into this resource set using any of the createResource methods.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
ResourceSetImpl.MappedResourceLocator, ResourceSetImpl.ResourceLocator, ResourceSetImpl.ResourcesEList<E extends Object & Resource>
-
Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
BasicNotifierImpl.EAdapterList<E extends Object & Adapter>, BasicNotifierImpl.EObservableAdapterList, BasicNotifierImpl.EScannableAdapterList
-
-
Field Summary
-
Fields inherited from class org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
adapterFactories, loadOptions, packageRegistry, resourceFactoryRegistry, resourceLocator, resources, uriConverter, uriResourceMap
-
Fields inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl
eAdapters, EDELIVER, eFlags, ELAST_NOTIFIER_FLAG
-
Fields inherited from interface org.eclipse.emf.compare.ide.internal.utils.DisposableResourceSet
XTEXT_SCOPING_LIVE_SCOPE_OPTION
-
Fields inherited from interface org.eclipse.emf.ecore.resource.ResourceSet
RESOURCE_SET__RESOURCES
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NotLoadingResourceSet
create(StorageTraversal traversals, org.eclipse.core.runtime.IProgressMonitor monitor, ResourceSetHookRegistry resourceSetHookRegistry)
Constructs a resource set to contain the resources described by the given traversals.Resource
createResource(URI uri, String contentType)
protected void
demandLoadHelper(Resource resource)
void
dispose()
This method should be called when the resource set is no longer needed.TreeIterator<Notifier>
getAllContents()
EObject
getEObject(URI uri, boolean loadOnDemand)
Map<Object,Object>
getLoadOptions()
Resource
getResource(URI uri, boolean loadOnDemand)
EList<Resource>
getResources()
protected void
handleDemandLoadException(Resource resource, IOException exception)
void
proxyCreated(Resource source, EObject eObject, EStructuralFeature eStructuralFeature, EObject proxy, int position)
This will be called when a proxy is created from one of the parser pool's parsers.void
setAllowResourceLoad(boolean allowResourceLoad)
Allow/disallow the resource set to load its resources when asked to.-
Methods inherited from class org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
createResource, delegatedGetResource, demandCreateResource, demandLoad, getAdapterFactories, getPackageRegistry, getResourceFactoryRegistry, getURIConverter, getURIResourceMap, setPackageRegistry, setResourceFactoryRegistry, setURIConverter, setURIResourceMap, toString
-
Methods inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl
eAdapters, eBasicAdapters, eDeliver, eSetDeliver
-
Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
eBasicAdapterArray, eBasicHasAdapters, eNotificationRequired, eNotify
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
-
Methods inherited from interface org.eclipse.emf.ecore.resource.ResourceSet
createResource, getAdapterFactories, getPackageRegistry, getResourceFactoryRegistry, getURIConverter, setPackageRegistry, setResourceFactoryRegistry, setURIConverter
-
-
-
-
Method Detail
-
create
public static NotLoadingResourceSet create(StorageTraversal traversals, org.eclipse.core.runtime.IProgressMonitor monitor, ResourceSetHookRegistry resourceSetHookRegistry)
Constructs a resource set to contain the resources described by the given traversals.- Parameters:
traversals
- All traversals we are to load.monitor
- the monitor to which progress will be reported.resourceSetHookRegistry
- A registry ofIResourceSetHook
s that potentialy can hook on the newResourceSet
(can benull
if none).- Returns:
- resource set containing the resources described by the given traversals.
-
demandLoadHelper
protected void demandLoadHelper(Resource resource)
- Overrides:
demandLoadHelper
in classResourceSetImpl
- See Also:
ResourceSetImpl.demandLoadHelper(org.eclipse.emf.ecore.resource.Resource)
-
handleDemandLoadException
protected void handleDemandLoadException(Resource resource, IOException exception)
-
getResource
public Resource getResource(URI uri, boolean loadOnDemand)
- Specified by:
getResource
in interfaceResourceSet
- Overrides:
getResource
in classResourceSetImpl
- See Also:
ResourceSetImpl.getResource(org.eclipse.emf.common.util.URI, boolean)
-
getLoadOptions
public Map<Object,Object> getLoadOptions()
- Specified by:
getLoadOptions
in interfaceResourceSet
- Overrides:
getLoadOptions
in classResourceSetImpl
-
dispose
public void dispose()
This method should be called when the resource set is no longer needed.- Specified by:
dispose
in interfaceDisposableResourceSet
- See Also:
DisposableResourceSet.dispose()
-
createResource
public Resource createResource(URI uri, String contentType)
- Specified by:
createResource
in interfaceResourceSet
- Overrides:
createResource
in classResourceSetImpl
- See Also:
ResourceSetImpl.createResource(org.eclipse.emf.common.util.URI, java.lang.String)
-
getEObject
public EObject getEObject(URI uri, boolean loadOnDemand)
- Specified by:
getEObject
in interfaceResourceSet
- Overrides:
getEObject
in classResourceSetImpl
- See Also:
ResourceSetImpl.getEObject(org.eclipse.emf.common.util.URI, boolean)
-
getAllContents
public TreeIterator<Notifier> getAllContents()
- Specified by:
getAllContents
in interfaceResourceSet
- Overrides:
getAllContents
in classResourceSetImpl
- See Also:
ResourceSetImpl.getAllContents()
-
getResources
public EList<Resource> getResources()
- Specified by:
getResources
in interfaceResourceSet
- Overrides:
getResources
in classResourceSetImpl
- See Also:
ResourceSetImpl.getResources()
-
proxyCreated
public void proxyCreated(Resource source, EObject eObject, EStructuralFeature eStructuralFeature, EObject proxy, int position)
This will be called when a proxy is created from one of the parser pool's parsers.- Specified by:
proxyCreated
in interfaceIProxyCreationListener
- Parameters:
source
- The resource in which a proxy has been created towards another.eObject
- The EObject on which some feature is going to be set with a proxy value.eStructuralFeature
- The structural feature which value will contain a proxy.proxy
- The actual proxy created for this eObject's feature.position
- Position at which the proxy is going to be inserted. This will be set to-1
when the proxy is added at the end of theeStructuralFeature
's values list (for multi-valued features) or if said feature is single-valued.
-
setAllowResourceLoad
public void setAllowResourceLoad(boolean allowResourceLoad)
Allow/disallow the resource set to load its resources when asked to. This is useful after the comparison process, where every resource should be loaded throughgetResource(URI, boolean)
.- Parameters:
allowResourceLoad
- true to allow the resource set to load its resources when asked to, false otherwise.
-
-