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 a
StorageTraversal
, 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
Modifier and TypeMethodDescriptionstatic 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.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.getEObject
(URI uri, boolean loadOnDemand) getResource
(URI uri, boolean loadOnDemand) Returns the map from URI to IStorage used internally by this resource set to load its content.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 Details
-
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
- Overrides:
demandLoadHelper
in classResourceSetImpl
- See Also:
-
handleDemandLoadException
-
getResource
- Specified by:
getResource
in interfaceResourceSet
- Overrides:
getResource
in classResourceSetImpl
- See Also:
-
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:
-
createResource
- Specified by:
createResource
in interfaceResourceSet
- Overrides:
createResource
in classResourceSetImpl
- See Also:
-
getEObject
- Specified by:
getEObject
in interfaceResourceSet
- Overrides:
getEObject
in classResourceSetImpl
- See Also:
-
getAllContents
- Specified by:
getAllContents
in interfaceResourceSet
- Overrides:
getAllContents
in classResourceSetImpl
- See Also:
-
getResources
- Specified by:
getResources
in interfaceResourceSet
- Overrides:
getResources
in classResourceSetImpl
- See Also:
-
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.
-
getStorageToURI
Returns the map from URI to IStorage used internally by this resource set to load its content.- Returns:
- The internal URI to IStorage map.
-