org.eclipse.emf.compare.ide.internal.utils

## 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

All Methods Static Methods Instance Methods Concrete Methods
`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.ecore.resource.ResourceSet

`createResource, getAdapterFactories, getPackageRegistry, getResourceFactoryRegistry, getURIConverter, setPackageRegistry, setResourceFactoryRegistry, setURIConverter`

### Methods inherited from interface org.eclipse.emf.common.notify.Notifier

`eAdapters, eDeliver, eNotify, eSetDeliver`

### 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 of `IResourceSetHook`s that potentialy can hook on the new `ResourceSet` (can be `null` if none).
Returns:
  resource set containing the resources described by the given traversals.

#### demandLoadHelper

    protected void demandLoadHelper(Resource resource)

Overrides:
  `demandLoadHelper` in class `ResourceSetImpl`
See Also:
  `ResourceSetImpl.demandLoadHelper(org.eclipse.emf.ecore.resource.Resource)`

#### handleDemandLoadException

    protected void handleDemandLoadException(Resource resource,
                                             IOException exception)

Overrides:
  `handleDemandLoadException` in class `ResourceSetImpl`
See Also:
  `ResourceSetImpl.handleDemandLoadException(org.eclipse.emf.ecore.resource.Resource, java.io.IOException)`

#### getResource

    public Resource getResource(URI uri,
                                boolean loadOnDemand)

Specified by:
  `getResource` in interface `ResourceSet`
Overrides:
  `getResource` in class `ResourceSetImpl`
See Also:
  `ResourceSetImpl.getResource(org.eclipse.emf.common.util.URI, boolean)`

#### getLoadOptions

    public Map<Object,Object> getLoadOptions()

Specified by:
  `getLoadOptions` in interface `ResourceSet`
Overrides:
  `getLoadOptions` in class `ResourceSetImpl`

#### dispose

    public void dispose()

This method should be called when the resource set is no longer needed.

Specified by:
  `dispose` in interface `DisposableResourceSet`
See Also:
  `DisposableResourceSet.dispose()`

#### createResource

    public Resource createResource(URI uri,
                                   String contentType)

Specified by:
  `createResource` in interface `ResourceSet`
Overrides:
  `createResource` in class `ResourceSetImpl`
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 interface `ResourceSet`
Overrides:
  `getEObject` in class `ResourceSetImpl`
See Also:
  `ResourceSetImpl.getEObject(org.eclipse.emf.common.util.URI, boolean)`

#### getAllContents

    public TreeIterator<Notifier> getAllContents()

Specified by:
  `getAllContents` in interface `ResourceSet`
Overrides:
  `getAllContents` in class `ResourceSetImpl`
See Also:
  `ResourceSetImpl.getAllContents()`

#### getResources

    public EList<Resource> getResources()

Specified by:
  `getResources` in interface `ResourceSet`
Overrides:
  `getResources` in class `ResourceSetImpl`
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 interface `IProxyCreationListener`
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 the `eStructuralFeature`'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 through `getResource(URI, boolean)`.

Parameters:
  `allowResourceLoad` - true to allow the resource set to load its resources when asked to, false otherwise.