Class EcoreHelper


  • public final class EcoreHelper
    extends java.lang.Object
    Helper methods for dealing with ecores.
    Since:
    1.13
    Author:
    Alexandra Buzila
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object[] getDefaultPackageRegistryContents()  
      static java.util.Set<java.lang.String> getOtherRelatedWorkspacePaths​(java.lang.String ecorePath)
      Returns the path for all ecores for which
      protected static void loadResource​(java.lang.String ecorePath, org.eclipse.emf.ecore.resource.Resource resource)
      Wraps loading a Resource in order to catch thrown IOExceptions and rethrow them with more informative messages.
      static void registerEcore​(java.lang.String ecorePath)
      Put an ecore's EPackage into the EPackage.Registry.
      static void unregisterEcore​(java.lang.String ecorePath)
      Remove the ecore's EPackage from the EPackage.Registry.
      • Methods inherited from class java.lang.Object

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

      • registerEcore

        public static void registerEcore​(java.lang.String ecorePath)
                                  throws java.io.IOException
        Put an ecore's EPackage into the EPackage.Registry. Subsequently, register all referenced ecores.
        Parameters:
        ecorePath - - path to the ecore
        Throws:
        java.io.IOException - if resource cannot be loaded
      • loadResource

        protected static void loadResource​(java.lang.String ecorePath,
                                           org.eclipse.emf.ecore.resource.Resource resource)
                                    throws java.io.IOException
        Wraps loading a Resource in order to catch thrown IOExceptions and rethrow them with more informative messages.
        Parameters:
        ecorePath - The path of the resource. Needed for informative messages
        resource - The Resource to load
        Throws:
        java.io.IOException - if the loading of the Resource fails
      • getOtherRelatedWorkspacePaths

        public static java.util.Set<java.lang.String> getOtherRelatedWorkspacePaths​(java.lang.String ecorePath)

        Returns the path for all ecores for which

        a) the given ecore is dependent on.

        b) the uri is a platform resource URI, meaning the ecore is available in the workspace.

        Parameters:
        ecorePath - the path
        Returns:
        the ecore nsuris
      • unregisterEcore

        public static void unregisterEcore​(java.lang.String ecorePath)
        Remove the ecore's EPackage from the EPackage.Registry. It also removes the packages of referenced ecores.
        Parameters:
        ecorePath - - the path of the ecore to be removed.
      • getDefaultPackageRegistryContents

        public static java.lang.Object[] getDefaultPackageRegistryContents()
        Returns:
        the EPackages which are registered in the EPackage registry by default (without the ones registered during runtime by the tooling).