Java Code Examples for org.eclipse.emf.ecore.resource.Resource#isLoaded()

The following examples show how to use org.eclipse.emf.ecore.resource.Resource#isLoaded() . 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
private void addRegisterEcoreFile(String fileName) throws IllegalArgumentException, SecurityException {
    Resource res = resourceSet.getResource(createURI(fileName), true);
    if (res == null) {
        throw new ConfigurationException("Couldn't find resource under  " + fileName);
    }
    if (!res.isLoaded()) {
        try {
            res.load(null);
        } catch (IOException e) {
            throw new ConfigurationException("Couldn't load resource under  " + fileName + " : " + e.getMessage());
        }
    }
    List<EObject> result = res.getContents();
    for (EObject object : result) {
        if (object instanceof EPackage) {
            registerPackage(fileName, object);
        }
        for (final TreeIterator<EObject> it = object.eAllContents(); it.hasNext();) {
            EObject child = it.next();
            if (child instanceof EPackage) {
                registerPackage(fileName, child);
            }
        }
    }
}
 
Example 2
@Override
public Set<String> removeAllModelsOfType(final String modelType) {
    Set<String> ret = new HashSet<>();
    synchronized (resourceSet) {
        // Make a copy to avoid ConcurrentModificationException
        List<Resource> resourceListCopy = new ArrayList<>(resourceSet.getResources());
        for (Resource resource : resourceListCopy) {
            if (resource.getURI().lastSegment().contains(".") && resource.isLoaded()
                    && modelType.equalsIgnoreCase(resource.getURI().fileExtension())
                    && !resource.getURI().lastSegment().startsWith("tmp_")) {
                logger.debug("Removing resource '{}'", resource.getURI().lastSegment());
                ret.add(resource.getURI().lastSegment());
                resourceSet.getResources().remove(resource);
                notifyListeners(resource.getURI().lastSegment(), EventType.REMOVED);
            }
        }
    }
    return ret;
}
 
Example 3
@Override
public Set<String> removeAllModelsOfType(final String modelType) {
    Set<String> ret = new HashSet<>();
    synchronized (resourceSet) {
        // Make a copy to avoid ConcurrentModificationException
        List<Resource> resourceListCopy = new ArrayList<Resource>(resourceSet.getResources());
        for (Resource resource : resourceListCopy) {
            if (resource != null && resource.getURI().lastSegment().contains(".") && resource.isLoaded()) {
                if (modelType.equalsIgnoreCase(resource.getURI().fileExtension())) {
                    logger.debug("Removing resource '{}'", resource.getURI().lastSegment());
                    ret.add(resource.getURI().lastSegment());
                    resourceSet.getResources().remove(resource);
                    notifyListeners(resource.getURI().lastSegment(), EventType.REMOVED);
                }
            }
        }
    }
    return ret;
}
 
Example 4
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources() {
	if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
		if (isDirty()) {
			changedResources.addAll(editingDomain.getResourceSet().getResources());
		}
		editingDomain.getCommandStack().flush();

		updateProblemIndication = false;
		for (Resource resource : changedResources) {
			if (resource.isLoaded()) {
				resource.unload();
				try {
					resource.load(Collections.EMPTY_MAP);
				}
				catch (IOException exception) {
					if (!resourceToDiagnosticMap.containsKey(resource)) {
						resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
					}
				}
			}
		}

		if (AdapterFactoryEditingDomain.isStale(editorSelection)) {
			setSelection(StructuredSelection.EMPTY);
		}

		updateProblemIndication = true;
		updateProblemIndication();
	}
}
 
Example 5
Source Project: neoscada   File: ItemEditor.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources ()
{
    if ( !changedResources.isEmpty () && ( !isDirty () || handleDirtyConflict () ) )
    {
        if ( isDirty () )
        {
            changedResources.addAll ( editingDomain.getResourceSet ().getResources () );
        }
        editingDomain.getCommandStack ().flush ();

        updateProblemIndication = false;
        for ( Resource resource : changedResources )
        {
            if ( resource.isLoaded () )
            {
                resource.unload ();
                try
                {
                    resource.load ( Collections.EMPTY_MAP );
                }
                catch ( IOException exception )
                {
                    if ( !resourceToDiagnosticMap.containsKey ( resource ) )
                    {
                        resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
                    }
                }
            }
        }

        if ( AdapterFactoryEditingDomain.isStale ( editorSelection ) )
        {
            setSelection ( StructuredSelection.EMPTY );
        }

        updateProblemIndication = true;
        updateProblemIndication ();
    }
}
 
Example 6
@Override
public Resource getResource(URI uri, boolean loadOnDemand) {
	Map<URI, Resource> map = getURIResourceMap();
	if (map == null || resourceLocator != null)
		return super.getResource(uri, loadOnDemand);
	Resource resource = map.get(uri);
	if (resource == null) {
		URI normalizedURI = getURIConverter().normalize(uri);
		resource = map.get(normalizedURI);
		if (resource != null) {
			normalizationMap.put(uri, normalizedURI);
		}
	}
	if (resource != null) {
		if (loadOnDemand && !resource.isLoaded()) {
			demandLoadHelper(resource);
		}
		return resource;
	}
	
    Resource delegatedResource = delegatedGetResource(uri, loadOnDemand);
    if (delegatedResource != null)
    {
      return delegatedResource;
    }

    if (loadOnDemand)
    {
      resource = demandCreateResource(uri);
      if (resource == null) {
        throw new RuntimeException("Cannot create a resource for '" + uri + "'; a registered resource factory is needed");
      }

      demandLoadHelper(resource);

      return resource;
    }

    return null;
}
 
Example 7
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources ()
{
    if ( !changedResources.isEmpty () && ( !isDirty () || handleDirtyConflict () ) )
    {
        if ( isDirty () )
        {
            changedResources.addAll ( editingDomain.getResourceSet ().getResources () );
        }
        editingDomain.getCommandStack ().flush ();

        updateProblemIndication = false;
        for ( Resource resource : changedResources )
        {
            if ( resource.isLoaded () )
            {
                resource.unload ();
                try
                {
                    resource.load ( Collections.EMPTY_MAP );
                }
                catch ( IOException exception )
                {
                    if ( !resourceToDiagnosticMap.containsKey ( resource ) )
                    {
                        resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
                    }
                }
            }
        }

        if ( AdapterFactoryEditingDomain.isStale ( editorSelection ) )
        {
            setSelection ( StructuredSelection.EMPTY );
        }

        updateProblemIndication = true;
        updateProblemIndication ();
    }
}
 
Example 8
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources ()
{
    if ( !changedResources.isEmpty () && ( !isDirty () || handleDirtyConflict () ) )
    {
        if ( isDirty () )
        {
            changedResources.addAll ( editingDomain.getResourceSet ().getResources () );
        }
        editingDomain.getCommandStack ().flush ();

        updateProblemIndication = false;
        for ( Resource resource : changedResources )
        {
            if ( resource.isLoaded () )
            {
                resource.unload ();
                try
                {
                    resource.load ( Collections.EMPTY_MAP );
                }
                catch ( IOException exception )
                {
                    if ( !resourceToDiagnosticMap.containsKey ( resource ) )
                    {
                        resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
                    }
                }
            }
        }

        if ( AdapterFactoryEditingDomain.isStale ( editorSelection ) )
        {
            setSelection ( StructuredSelection.EMPTY );
        }

        updateProblemIndication = true;
        updateProblemIndication ();
    }
}
 
Example 9
Source Project: neoscada   File: SetupEditor.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources ()
{
    if ( !changedResources.isEmpty () && ( !isDirty () || handleDirtyConflict () ) )
    {
        if ( isDirty () )
        {
            changedResources.addAll ( editingDomain.getResourceSet ().getResources () );
        }
        editingDomain.getCommandStack ().flush ();

        updateProblemIndication = false;
        for ( Resource resource : changedResources )
        {
            if ( resource.isLoaded () )
            {
                resource.unload ();
                try
                {
                    resource.load ( Collections.EMPTY_MAP );
                }
                catch ( IOException exception )
                {
                    if ( !resourceToDiagnosticMap.containsKey ( resource ) )
                    {
                        resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
                    }
                }
            }
        }

        if ( AdapterFactoryEditingDomain.isStale ( editorSelection ) )
        {
            setSelection ( StructuredSelection.EMPTY );
        }

        updateProblemIndication = true;
        updateProblemIndication ();
    }
}
 
Example 10
Source Project: neoscada   File: ProfileEditor.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources ()
{
    if ( !changedResources.isEmpty () && ( !isDirty () || handleDirtyConflict () ) )
    {
        if ( isDirty () )
        {
            changedResources.addAll ( editingDomain.getResourceSet ().getResources () );
        }
        editingDomain.getCommandStack ().flush ();

        updateProblemIndication = false;
        for ( Resource resource : changedResources )
        {
            if ( resource.isLoaded () )
            {
                resource.unload ();
                try
                {
                    resource.load ( Collections.EMPTY_MAP );
                }
                catch ( IOException exception )
                {
                    if ( !resourceToDiagnosticMap.containsKey ( resource ) )
                    {
                        resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
                    }
                }
            }
        }

        if ( AdapterFactoryEditingDomain.isStale ( editorSelection ) )
        {
            setSelection ( StructuredSelection.EMPTY );
        }

        updateProblemIndication = true;
        updateProblemIndication ();
    }
}
 
Example 11
Source Project: neoscada   File: WorldEditor.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources ()
{
    if ( !changedResources.isEmpty () && ( !isDirty () || handleDirtyConflict () ) )
    {
        if ( isDirty () )
        {
            changedResources.addAll ( editingDomain.getResourceSet ().getResources () );
        }
        editingDomain.getCommandStack ().flush ();

        updateProblemIndication = false;
        for ( Resource resource : changedResources )
        {
            if ( resource.isLoaded () )
            {
                resource.unload ();
                try
                {
                    resource.load ( Collections.EMPTY_MAP );
                }
                catch ( IOException exception )
                {
                    if ( !resourceToDiagnosticMap.containsKey ( resource ) )
                    {
                        resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
                    }
                }
            }
        }

        if ( AdapterFactoryEditingDomain.isStale ( editorSelection ) )
        {
            setSelection ( StructuredSelection.EMPTY );
        }

        updateProblemIndication = true;
        updateProblemIndication ();
    }
}
 
Example 12
Source Project: neoscada   File: MemoryEditor.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources ()
{
    if ( !changedResources.isEmpty () && ( !isDirty () || handleDirtyConflict () ) )
    {
        if ( isDirty () )
        {
            changedResources.addAll ( editingDomain.getResourceSet ().getResources () );
        }
        editingDomain.getCommandStack ().flush ();

        updateProblemIndication = false;
        for ( Resource resource : changedResources )
        {
            if ( resource.isLoaded () )
            {
                resource.unload ();
                try
                {
                    resource.load ( Collections.EMPTY_MAP );
                }
                catch ( IOException exception )
                {
                    if ( !resourceToDiagnosticMap.containsKey ( resource ) )
                    {
                        resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
                    }
                }
            }
        }

        if ( AdapterFactoryEditingDomain.isStale ( editorSelection ) )
        {
            setSelection ( StructuredSelection.EMPTY );
        }

        updateProblemIndication = true;
        updateProblemIndication ();
    }
}
 
Example 13
Source Project: ifml-editor   File: CoreEditor.java    License: MIT License 5 votes vote down vote up
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources() {
	if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
		if (isDirty()) {
			changedResources.addAll(editingDomain.getResourceSet().getResources());
		}
		editingDomain.getCommandStack().flush();

		updateProblemIndication = false;
		for (Resource resource : changedResources) {
			if (resource.isLoaded()) {
				resource.unload();
				try {
					resource.load(Collections.EMPTY_MAP);
				}
				catch (IOException exception) {
					if (!resourceToDiagnosticMap.containsKey(resource)) {
						resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
					}
				}
			}
		}

		if (AdapterFactoryEditingDomain.isStale(editorSelection)) {
			setSelection(StructuredSelection.EMPTY);
		}

		updateProblemIndication = true;
		updateProblemIndication();
	}
}
 
Example 14
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources ()
{
    if ( !changedResources.isEmpty () && ( !isDirty () || handleDirtyConflict () ) )
    {
        if ( isDirty () )
        {
            changedResources.addAll ( editingDomain.getResourceSet ().getResources () );
        }
        editingDomain.getCommandStack ().flush ();

        updateProblemIndication = false;
        for ( Resource resource : changedResources )
        {
            if ( resource.isLoaded () )
            {
                resource.unload ();
                try
                {
                    resource.load ( Collections.EMPTY_MAP );
                }
                catch ( IOException exception )
                {
                    if ( !resourceToDiagnosticMap.containsKey ( resource ) )
                    {
                        resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
                    }
                }
            }
        }

        if ( AdapterFactoryEditingDomain.isStale ( editorSelection ) )
        {
            setSelection ( StructuredSelection.EMPTY );
        }

        updateProblemIndication = true;
        updateProblemIndication ();
    }
}
 
Example 15
Source Project: M2Doc   File: GenconfEditor.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
protected void handleChangedResources() {
    if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
        if (isDirty()) {
            changedResources.addAll(editingDomain.getResourceSet().getResources());
        }
        editingDomain.getCommandStack().flush();

        updateProblemIndication = false;
        for (Resource resource : changedResources) {
            if (resource.isLoaded()) {
                resource.unload();
                try {
                    resource.load(Collections.EMPTY_MAP);
                } catch (IOException exception) {
                    if (!resourceToDiagnosticMap.containsKey(resource)) {
                        resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
                    }
                }
            }
        }

        if (AdapterFactoryEditingDomain.isStale(editorSelection)) {
            setSelection(StructuredSelection.EMPTY);
        }

        updateProblemIndication = true;
        updateProblemIndication();
    }
}
 
Example 16
/**
* @generated
*/
public void notifyChanged(Notification notification) {
	if (notification.getNotifier() instanceof ResourceSet) {
		super.notifyChanged(notification);
	}
	if (!notification.isTouch() && myModifiedFilter.matches(notification)) {
		if (notification.getNotifier() instanceof Resource) {
			Resource resource = (Resource) notification.getNotifier();
			if (resource.isLoaded()) {
				boolean modified = false;
				for (Iterator /*<org.eclipse.emf.ecore.resource.Resource>*/ it = myInfo
						.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
					Resource nextResource = (Resource) it.next();
					if (nextResource.isLoaded()) {
						modified = nextResource.isModified();
					}
				}
				boolean dirtyStateChanged = false;
				synchronized (myInfo) {
					if (modified != myInfo.fCanBeSaved) {
						myInfo.fCanBeSaved = modified;
						dirtyStateChanged = true;
					}
					if (!resource.isModified()) {
						myInfo.setSynchronized(resource);
					}
				}
				if (dirtyStateChanged) {
					fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);

					if (!modified) {
						myInfo.setModificationStamp(computeModificationStamp(myInfo));
					}
				}
			}
		}
	}
}
 
Example 17
Source Project: n4js   File: N4JSResource.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Convenience method to fully resolve all lazy cross-references and perform post-processing on the N4JSResource
 * 'resource'. Does nothing if 'resource' is <code>null</code> or not an N4JSResource.
 */
public static final void postProcess(Resource resource) {
	if (resource instanceof N4JSResource && resource.isLoaded())
		((N4JSResource) resource).performPostProcessing();
}
 
Example 18
/** {@inheritDoc} */
@Override
protected IStatus run(final IProgressMonitor monitor) {

  // Let's start (number of task = number of resource * 2 (loading + validating))
  monitor.beginTask("", 2 * this.uris.size()); //$NON-NLS-1$

  for (final URI uri : this.uris) {
    // Last chance to cancel before next validation
    if (monitor.isCanceled()) {
      return Status.CANCEL_STATUS;
    }

    final IResourceServiceProvider serviceProvider = serviceProviderRegistry.getResourceServiceProvider(uri);
    if (serviceProvider == null) {
      // This may happen for non-Xtext resources in ice entities
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(MessageFormat.format("Could not validate {0}: no resource service provider found", uri.toString())); //$NON-NLS-1$
      }
      continue; // Skip to next URI
    }

    final IResourceValidator resourceValidator = serviceProvider.getResourceValidator();
    final IStorage2UriMapper uriMapper = serviceProvider.get(IStorage2UriMapper.class);
    final MarkerCreator markerCreator = serviceProvider.get(MarkerCreator.class);

    // Get the file; only local files will be re-validated, derived files are ignored
    final IFile iFile = getFileFromStorageMapper(uriMapper, uri);
    if (iFile == null) {
      continue; // no storage mapping found for this URI
    }

    if (resourceValidator == null) {
      LOGGER.error(MessageFormat.format("Could not validate {0}: no resource validator found", iFile.getName())); //$NON-NLS-1$
    } else if (iFile != null) {
      monitor.subTask("loading " + iFile.getName()); //$NON-NLS-1$

      // Don't try to evaluate resource set before it has been checked that the storage provider contains a mapping
      // for current uri
      final ResourceSet resourceSet = getResourceSet(uriMapper, uri);

      // Load the corresponding resource
      boolean loaded = false;
      Resource eResource = null;
      try {
        eResource = resourceSet.getResource(uri, false);
        if ((eResource == null) || (eResource != null && !eResource.isLoaded())) {
          // if the resource does not exist in the resource set, or is not loaded yet
          // load it.
          eResource = resourceSet.getResource(uri, true);
          loaded = true;
        }
        monitor.worked(1);
        // CHECKSTYLE:OFF
      } catch (final RuntimeException e) {
        // CHECKSTYLE:ON
        LOGGER.error(MessageFormat.format("{0} could not be validated.", iFile.getName()), e); //$NON-NLS-1$
      } finally {
        if (eResource != null) {
          validateAndCreateMarkers(resourceValidator, markerCreator, iFile, eResource, monitor);
          LOGGER.debug("Validated " + uri); //$NON-NLS-1$
          if (loaded) { // NOPMD
            // unload any resource that was previously loaded as part of this loop.
            eResource.unload();
          }
        }
      }
    }
  }

  monitor.done();

  return Status.OK_STATUS;
}
 
Example 19
Source Project: neoscada   File: ChartEditor.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
protected void handleChangedResources ()
{
    if ( !this.changedResources.isEmpty ()
            && ( !isDirty () || handleDirtyConflict () ) )
    {
        if ( isDirty () )
        {
            this.changedResources.addAll ( this.editingDomain.getResourceSet ()
                    .getResources () );
        }
        this.editingDomain.getCommandStack ().flush ();

        this.updateProblemIndication = false;
        for ( final Resource resource : this.changedResources )
        {
            if ( resource.isLoaded () )
            {
                resource.unload ();
                try
                {
                    resource.load ( Collections.EMPTY_MAP );
                }
                catch ( final IOException exception )
                {
                    if ( !this.resourceToDiagnosticMap.containsKey ( resource ) )
                    {
                        this.resourceToDiagnosticMap
                                .put ( resource,
                                        analyzeResourceProblems ( resource,
                                                exception ) );
                    }
                }
            }
        }

        if ( AdapterFactoryEditingDomain.isStale ( this.editorSelection ) )
        {
            setSelection ( StructuredSelection.EMPTY );
        }

        this.updateProblemIndication = true;
        updateProblemIndication ();
    }
}
 
Example 20
/** {@inheritDoc} */
@Override
protected IStatus run(final IProgressMonitor monitor) {
  final IResourceValidator resourceValidator = resourceServiceProvider.getResourceValidator();

  // Object the list of resources
  final List<URI> uris = getResourceDescriptionURIs();

  // Let's start (number of task = number of resource * 2 (loading + validating))
  monitor.beginTask("", uris.size() * 2); //$NON-NLS-1$

  for (final URI uri : uris) {
    // Last chance to cancel before next validation
    if (monitor.isCanceled()) {
      return Status.CANCEL_STATUS;
    }

    // Get the file; only local files will be re-validated, derived files are ignored
    final IFile iFile = getFileFromStorageMapper(uri);
    if (iFile != null && !iFile.isDerived(IFile.CHECK_ANCESTORS)) {
      monitor.subTask("loading " + iFile.getName()); //$NON-NLS-1$

      // Load the corresponding resource
      boolean loaded = false;
      Resource eResource = null;
      try {
        eResource = resourceSet.getResource(uri, false);
        if ((eResource == null) || (eResource != null && !eResource.isLoaded())) {
          // if the resource does not exist in the resource set, or is not loaded yet
          // load it.
          eResource = resourceSet.getResource(uri, true);
          loaded = true;
        }
        monitor.worked(1);
        // CHECKSTYLE:OFF
      } catch (final RuntimeException e) {
        // CHECKSTYLE:ON
        LOGGER.error(MessageFormat.format("{0} could not be validated.", iFile.getName()), e); //$NON-NLS-1$
      } finally {
        if (eResource != null) {
          validate(resourceValidator, iFile, eResource, monitor);
          if (loaded) { // NOPMD
            // unload any resource that was previously loaded as part of this loop.
            eResource.unload();
          }
        }
      }
    }
  }

  monitor.done();

  return Status.OK_STATUS;
}