Class ResourceSetHelpers


  • public final class ResourceSetHelpers
    extends java.lang.Object
    The Class ResourceSetHelpers. It is a utility class to perform operations on ResourceSet objects.
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static boolean addResourceToSet​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, org.eclipse.emf.common.util.URI resourceURI)
      static boolean addResourceToSet​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, org.eclipse.emf.common.util.URI resourceURI, java.util.Map<java.lang.Object,​java.lang.Object> loadOptions)
      Loads a resource from resourceURI and adds it to the resourceSet.
      static org.eclipse.emf.ecore.resource.ResourceSet createResourceSet​(org.eclipse.emf.common.command.CommandStack commandStack)
      Creates a ResourceSet with a CommandStack attached to it.
      static org.eclipse.emf.ecore.resource.ResourceSet createResourceSet​(org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain domain)
      Creates a ResourceSet with the given EditingDomain.
      static <T> java.util.List<T> findAllOf​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, java.lang.Class<T> clazz, boolean includeEcorePackage)
      Find all of type in the ResourceSet.
      static <T> java.util.List<T> findAllOfTypeInResourceSet​(org.eclipse.emf.ecore.EObject object, java.lang.Class<T> clazz, boolean includeEcorePackage)
      Find all of type in resource set.
      static java.util.List<?> findAllOfTypeInResourceSet​(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EClassifier type, boolean includeEcorePackage)
      Find all of type in resource set.
      static org.eclipse.emf.ecore.resource.ResourceSet loadResourceSetWithProxies​(org.eclipse.emf.common.util.URI resourceURI, org.eclipse.emf.common.command.BasicCommandStack commandStack)
      static org.eclipse.emf.ecore.resource.ResourceSet loadResourceSetWithProxies​(org.eclipse.emf.common.util.URI resourceURI, org.eclipse.emf.common.command.BasicCommandStack commandStack, java.util.Map<java.lang.Object,​java.lang.Object> options)
      Load resource set with proxies.
      static org.eclipse.emf.ecore.resource.ResourceSet loadResourceWithProxies​(org.eclipse.emf.common.util.URI resourceURI, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
      static org.eclipse.emf.ecore.resource.ResourceSet loadResourceWithProxies​(org.eclipse.emf.common.util.URI resourceURI, org.eclipse.emf.ecore.resource.ResourceSet resourceSet, java.util.Map<java.lang.Object,​java.lang.Object> loadOptions)
      Load resource set with proxies.
      static void resolveAllProxies​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
      Visits all proxies in the resource set and tries to resolve them.
      static boolean save​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
      Deprecated.
      static boolean save​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, java.util.Map<java.lang.Object,​java.lang.Object> saveOptions)
      Save all changes in a ResourceSet.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • save

        @Deprecated
        public static boolean save​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
        Deprecated.
        Save all changes in a ResourceSet.
        Parameters:
        resourceSet - the resource set
        Returns:
        true, if successful
      • save

        public static boolean save​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                   java.util.Map<java.lang.Object,​java.lang.Object> saveOptions)
        Save all changes in a ResourceSet.
        Parameters:
        resourceSet - the resource set
        saveOptions - the save options
        Returns:
        true, if successful
        Since:
        1.19
      • loadResourceSetWithProxies

        @Deprecated
        public static org.eclipse.emf.ecore.resource.ResourceSet loadResourceSetWithProxies​(org.eclipse.emf.common.util.URI resourceURI,
                                                                                            org.eclipse.emf.common.command.BasicCommandStack commandStack)
        Load resource set with proxies.
        Parameters:
        resourceURI - the resource uri (= File to load)
        commandStack - the command stack
        Returns:
        the resource set
      • loadResourceSetWithProxies

        public static org.eclipse.emf.ecore.resource.ResourceSet loadResourceSetWithProxies​(org.eclipse.emf.common.util.URI resourceURI,
                                                                                            org.eclipse.emf.common.command.BasicCommandStack commandStack,
                                                                                            java.util.Map<java.lang.Object,​java.lang.Object> options)
                                                                                     throws java.io.IOException
        Load resource set with proxies.
        Parameters:
        resourceURI - the resource uri (= File to load)
        commandStack - the command stack
        options - the resource load options
        Returns:
        the resource set
        Throws:
        java.io.IOException - if an error occurred while loading the resource
        Since:
        1.19
      • loadResourceWithProxies

        @Deprecated
        public static org.eclipse.emf.ecore.resource.ResourceSet loadResourceWithProxies​(org.eclipse.emf.common.util.URI resourceURI,
                                                                                         org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
        Load resource set with proxies.
        Parameters:
        resourceURI - the resource uri (= File to load)
        resourceSet - the resource set
        Returns:
        the resource set
        Since:
        1.10
      • loadResourceWithProxies

        public static org.eclipse.emf.ecore.resource.ResourceSet loadResourceWithProxies​(org.eclipse.emf.common.util.URI resourceURI,
                                                                                         org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                                                                         java.util.Map<java.lang.Object,​java.lang.Object> loadOptions)
                                                                                  throws java.io.IOException
        Load resource set with proxies.
        Parameters:
        resourceURI - the resource uri (= File to load)
        resourceSet - the resource set
        loadOptions - the resource load options
        Returns:
        the resource set
        Throws:
        java.io.IOException - if an error occurred while loading the resource
        Since:
        1.19
      • createResourceSet

        public static org.eclipse.emf.ecore.resource.ResourceSet createResourceSet​(org.eclipse.emf.common.command.CommandStack commandStack)
        Creates a ResourceSet with a CommandStack attached to it.
        Parameters:
        commandStack - the command stack
        Returns:
        the resource set
        Since:
        1.10
      • createResourceSet

        public static org.eclipse.emf.ecore.resource.ResourceSet createResourceSet​(org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain domain)
        Creates a ResourceSet with the given EditingDomain.
        Parameters:
        domain - the editing domain
        Returns:
        the resource set
        Since:
        1.11
      • addResourceToSet

        @Deprecated
        public static boolean addResourceToSet​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                               org.eclipse.emf.common.util.URI resourceURI)
        Loads a resource from resourceURI and adds it to the resourceSet.
        Parameters:
        resourceSet - the resource set
        resourceURI - the resource uri
        Returns:
        true, if successful
      • addResourceToSet

        public static boolean addResourceToSet​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                               org.eclipse.emf.common.util.URI resourceURI,
                                               java.util.Map<java.lang.Object,​java.lang.Object> loadOptions)
                                        throws java.io.IOException
        Loads a resource from resourceURI and adds it to the resourceSet.
        Parameters:
        resourceSet - the resource set
        resourceURI - the resource uri
        loadOptions - the resource load options
        Returns:
        true, if successful
        Throws:
        java.io.IOException - if an error occurred while loading the resource
        Since:
        1.18
      • resolveAllProxies

        public static void resolveAllProxies​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
        Visits all proxies in the resource set and tries to resolve them. Recursively also resolves all resources added during the resolvement of the initial resources.
        Parameters:
        resourceSet - The ResourceSet containing the Resources to resolve
        Since:
        1.22
      • findAllOfTypeInResourceSet

        public static java.util.List<?> findAllOfTypeInResourceSet​(org.eclipse.emf.ecore.EObject object,
                                                                   org.eclipse.emf.ecore.EClassifier type,
                                                                   boolean includeEcorePackage)
        Find all of type in resource set.
        Parameters:
        object - the object
        type - the type
        includeEcorePackage - the include ecore package
        Returns:
        the list
      • findAllOfTypeInResourceSet

        public static <T> java.util.List<T> findAllOfTypeInResourceSet​(org.eclipse.emf.ecore.EObject object,
                                                                       java.lang.Class<T> clazz,
                                                                       boolean includeEcorePackage)
        Find all of type in resource set.
        Type Parameters:
        T - the generic type
        Parameters:
        object - the object
        clazz - the clazz
        includeEcorePackage - the include ecore package
        Returns:
        the list
      • findAllOf

        public static <T> java.util.List<T> findAllOf​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                                      java.lang.Class<T> clazz,
                                                      boolean includeEcorePackage)
        Find all of type in the ResourceSet.
        Type Parameters:
        T - the generic type
        Parameters:
        resourceSet - the resource set
        clazz - the clazz
        includeEcorePackage - the include ecore package
        Returns:
        the list