Class ResourceRegistry


  • public class ResourceRegistry
    extends java.lang.Object
    Registers type registries for resource (URIs). This allows the UI parts of xText editors to access to correct type registry.
    Author:
    Holger Eichelberger
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Map<org.eclipse.emf.common.util.URI,​TypeRegistry> MAP  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ResourceRegistry()
      Prevents external object creation.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void clear()
      Clears the registry.
      static TypeRegistry getTypeRegistry​(java.net.URI uri)
      Registers a type registry for a given resource (via its URI).
      static TypeRegistry getTypeRegistry​(org.eclipse.emf.common.util.URI uri)
      Returns the type registry for a given URI.
      static TypeRegistry getTypeRegistry​(org.eclipse.emf.ecore.EObject object)
      Returns the type registry for a given (grammar tree) EObject (via its resource URI).
      static TypeRegistry getTypeRegistry​(org.eclipse.emf.ecore.resource.Resource resource)
      Returns the type registry for a given resource (via its URI).
      static TypeRegistry getTypeRegistry​(org.eclipse.xtext.nodemodel.INode node)
      Returns the type registry for a given (parse tree) node (via its resource URI).
      static void register​(org.eclipse.emf.common.util.URI uri, TypeRegistry registry)
      Registers a type registry for a given URI.
      static void register​(org.eclipse.emf.ecore.resource.Resource resource, TypeRegistry registry)
      Registers a type registry for a given resource (via its URI).
      static void unregister​(org.eclipse.emf.common.util.URI uri)
      Unregisters the type registry for a given URI.
      static void unregister​(org.eclipse.emf.ecore.resource.Resource resource)
      Unregisters the type registry for a given resource (via its URI).
      • Methods inherited from class java.lang.Object

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

      • MAP

        private static final java.util.Map<org.eclipse.emf.common.util.URI,​TypeRegistry> MAP
    • Constructor Detail

      • ResourceRegistry

        private ResourceRegistry()
        Prevents external object creation.
    • Method Detail

      • clear

        public static void clear()
        Clears the registry.
      • unregister

        public static void unregister​(org.eclipse.emf.common.util.URI uri)
        Unregisters the type registry for a given URI.
        Parameters:
        uri - the URI (may be null)
      • unregister

        public static void unregister​(org.eclipse.emf.ecore.resource.Resource resource)
        Unregisters the type registry for a given resource (via its URI).
        Parameters:
        resource - the resource (may be null)
        See Also:
        unregister(URI)
      • register

        public static void register​(org.eclipse.emf.common.util.URI uri,
                                    TypeRegistry registry)
        Registers a type registry for a given URI. Registration happens only if uri is not null and the given registry is not TypeRegistry.DEFAULT.
        Parameters:
        uri - the URI to register the registry for
        registry - the registry to be registered
      • register

        public static void register​(org.eclipse.emf.ecore.resource.Resource resource,
                                    TypeRegistry registry)
        Registers a type registry for a given resource (via its URI). Registration happens only if resource (and its URI) are not null and the given registry is not TypeRegistry.DEFAULT.
        Parameters:
        uri - the URI to register the registry for (may be null)
        registry - the registry to be registered
      • getTypeRegistry

        public static TypeRegistry getTypeRegistry​(java.net.URI uri)
        Registers a type registry for a given resource (via its URI). Registration happens only if resource (and its URI) are not null and the given registry is not TypeRegistry.DEFAULT.
        Parameters:
        uri - the URI to register the registry for (may be null)
        registry - the registry to be registered
      • getTypeRegistry

        public static TypeRegistry getTypeRegistry​(org.eclipse.emf.common.util.URI uri)
        Returns the type registry for a given URI.
        Parameters:
        uri - the URL the type registry shall be returned for (may be null)
        Returns:
        the related type registry or TypeRegistry.DEFAULT if non was registered
      • getTypeRegistry

        public static TypeRegistry getTypeRegistry​(org.eclipse.emf.ecore.resource.Resource resource)
        Returns the type registry for a given resource (via its URI).
        Parameters:
        resource - the resource the type registry shall be returned for (may be null)
        Returns:
        the related type registry or TypeRegistry.DEFAULT if non was registered
        See Also:
        getTypeRegistry(URI)
      • getTypeRegistry

        public static TypeRegistry getTypeRegistry​(org.eclipse.xtext.nodemodel.INode node)
        Returns the type registry for a given (parse tree) node (via its resource URI).
        Parameters:
        node - the node the type registry shall be returned for (may be null)
        Returns:
        the related type registry or TypeRegistry.DEFAULT if non was registered
        See Also:
        getTypeRegistry(EObject)
      • getTypeRegistry

        public static TypeRegistry getTypeRegistry​(org.eclipse.emf.ecore.EObject object)
        Returns the type registry for a given (grammar tree) EObject (via its resource URI).
        Parameters:
        object - the object the type registry shall be returned for (may be null)
        Returns:
        the related type registry or TypeRegistry.DEFAULT if non was registered
        See Also:
        getTypeRegistry(Resource)