org.eclipse.emf.ecore.plugin
Class EcorePlugin

java.lang.Object
  extended by org.eclipse.emf.common.util.DelegatingResourceLocator
      extended by org.eclipse.emf.common.EMFPlugin
          extended by org.eclipse.emf.ecore.plugin.EcorePlugin
All Implemented Interfaces:
Logger, ResourceLocator

public class EcorePlugin
extends EMFPlugin

A collection of platform-neutral static utilities as well as Eclipse support utilities.


Nested Class Summary
static class EcorePlugin.Implementation
          A plugin implementation that handles Ecore plugin registration.
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.EMFPlugin
EMFPlugin.EclipsePlugin, EMFPlugin.InternalEclipsePlugin, EMFPlugin.InternalHelper
 
Field Summary
static java.lang.String CONTENT_HANDLER_PPID
           
static java.lang.String CONTENT_PARSER_PPID
           
static java.lang.String CONVERSION_DELEGATE_PPID
           
static java.lang.String DYNAMIC_PACKAGE_PPID
           
static java.lang.String EXTENSION_PARSER_PPID
           
static java.lang.String FACTORY_OVERRIDE_PPID
           
static java.lang.String GENERATED_PACKAGE_PPID
           
static EcorePlugin INSTANCE
          The singleton instance of the plugin.
static java.lang.String INVOCATION_DELEGATE_PPID
           
static java.lang.String PACKAGE_REGISTRY_IMPLEMENTATION_PPID
           
static java.lang.String PROTOCOL_PARSER_PPID
           
static java.lang.String QUERY_DELEGATE_PPID
           
static java.lang.String SCHEME_PARSER_PPID
           
static java.lang.String SETTING_DELEGATE_PPID
           
static java.lang.String URI_MAPPING_PPID
           
static java.lang.String VALIDATION_DELEGATE_PPID
           
 
Fields inherited from class org.eclipse.emf.common.EMFPlugin
delegateResourceLocators, IS_ECLIPSE_RUNNING, IS_RESOURCES_BUNDLE_AVAILABLE
 
Fields inherited from class org.eclipse.emf.common.util.DelegatingResourceLocator
baseURL, images, resourceBundle, shouldTranslate, strings, untranslatedResourceBundle, untranslatedStrings
 
Method Summary
static java.util.Map<URI,URI> computePlatformPluginToPlatformResourceMap()
          Computes a map from platform:/plugin/<plugin-id>/ URI to platform:/resource/<plugin-location>/ URI for each plugin project in the workspace.
static java.util.Map<URI,URI> computePlatformResourceToPlatformPluginMap(java.util.Collection<URI> uris)
          Computes a map from platform:/resource/<plugin-location>/ URI to platform:/plugin/<plugin-id>/ URI for each URI in the collection of the form platform:/plugin/<plugin-id>/...
static java.util.Map<URI,URI> computePlatformURIMap()
          Computes a map so that plugins in the workspace will override those in the environment and so that plugins with Ecore and GenModels will look like projects in the workspace.
static EPackage.Registry getDefaultRegistryImplementation()
          Returns the default registry implementation singleton.
static java.util.Map<java.lang.String,URI> getEPackageNsURIToGenModelLocationMap()
          Returns a map from package namespace URI (represented as a String) to the location of the GenModel containing a GenPackage for the package (represented as a URI).
static java.util.Map<java.lang.String,URI> getPlatformResourceMap()
          Returns the platform resource map.
static EcorePlugin.Implementation getPlugin()
          Returns the Eclipse plugin singleton.
 ResourceLocator getPluginResourceLocator()
          Returns an Eclipse plugin implementation of a resource locator.
static IWorkspaceRoot getWorkspaceRoot()
          Returns the workspace root, or null, if the runtime environment is stand-alone.
static java.lang.String[] handlePlatformResourceOptions(java.lang.String[] arguments)
          Handles recognized platform resource arguments and returns the stripped result.
static URI resolvePlatformResourcePath(java.lang.String platformResourcePath)
          Resolves a platform resource path of the form "/project/path" against the platform resource map.
 
Methods inherited from class org.eclipse.emf.common.EMFPlugin
getDelegateResourceLocators, getPluginLogger, getPrimaryResourceLocator, getSymbolicName, log, main
 
Methods inherited from class org.eclipse.emf.common.util.DelegatingResourceLocator
delegatedGetImage, delegatedGetString, doGetImage, doGetString, extensionFor, getBaseURL, getImage, getString, getString, getString, getString, setShouldTranslate, shouldTranslate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.common.util.ResourceLocator
getBaseURL, getImage, getString, getString, getString, getString
 

Field Detail

INSTANCE

public static final EcorePlugin INSTANCE
The singleton instance of the plugin.


DYNAMIC_PACKAGE_PPID

public static final java.lang.String DYNAMIC_PACKAGE_PPID
See Also:
Constant Field Values

GENERATED_PACKAGE_PPID

public static final java.lang.String GENERATED_PACKAGE_PPID
See Also:
Constant Field Values

FACTORY_OVERRIDE_PPID

public static final java.lang.String FACTORY_OVERRIDE_PPID
See Also:
Constant Field Values

EXTENSION_PARSER_PPID

public static final java.lang.String EXTENSION_PARSER_PPID
See Also:
Constant Field Values

PROTOCOL_PARSER_PPID

public static final java.lang.String PROTOCOL_PARSER_PPID
See Also:
Constant Field Values

CONTENT_PARSER_PPID

public static final java.lang.String CONTENT_PARSER_PPID
See Also:
Constant Field Values

CONTENT_HANDLER_PPID

public static final java.lang.String CONTENT_HANDLER_PPID
See Also:
Constant Field Values

SCHEME_PARSER_PPID

public static final java.lang.String SCHEME_PARSER_PPID
See Also:
Constant Field Values

URI_MAPPING_PPID

public static final java.lang.String URI_MAPPING_PPID
See Also:
Constant Field Values

PACKAGE_REGISTRY_IMPLEMENTATION_PPID

public static final java.lang.String PACKAGE_REGISTRY_IMPLEMENTATION_PPID
See Also:
Constant Field Values

VALIDATION_DELEGATE_PPID

public static final java.lang.String VALIDATION_DELEGATE_PPID
See Also:
Constant Field Values

SETTING_DELEGATE_PPID

public static final java.lang.String SETTING_DELEGATE_PPID
See Also:
Constant Field Values

INVOCATION_DELEGATE_PPID

public static final java.lang.String INVOCATION_DELEGATE_PPID
See Also:
Constant Field Values

QUERY_DELEGATE_PPID

public static final java.lang.String QUERY_DELEGATE_PPID
See Also:
Constant Field Values

CONVERSION_DELEGATE_PPID

public static final java.lang.String CONVERSION_DELEGATE_PPID
See Also:
Constant Field Values
Method Detail

getPluginResourceLocator

public ResourceLocator getPluginResourceLocator()
Description copied from class: EMFPlugin
Returns an Eclipse plugin implementation of a resource locator.

Specified by:
getPluginResourceLocator in class EMFPlugin
Returns:
an Eclipse plugin implementation of a resource locator.

getPlatformResourceMap

public static java.util.Map<java.lang.String,URI> getPlatformResourceMap()
Returns the platform resource map.

This map is from String to URI. It is the logical equivalent of the map implied by an IWorkspaceRoot: I.e., each entry in the map corresponds to an IProject that has a name and a location location; the name is the key and the location, interpreted as a file URI, is the value. This map is used to resolve a platform resource path, and thereby supports relocatable projects in a manner that is transparently the same as an Eclipse workspace.

Returns:
the platform resource map.
See Also:
resolvePlatformResourcePath(java.lang.String)

resolvePlatformResourcePath

public static URI resolvePlatformResourcePath(java.lang.String platformResourcePath)
Resolves a platform resource path of the form "/project/path" against the platform resource map.

The first segment of the path, i.e., the project name, is used to get a URI from the map. If a URI results, the remaining segments are resolved against it and that is the result. Otherwise, the result is null. For example, given this mapping

  EcoreUtil.getPlatformResourceMap().put
    ("project", URI.createURI("file:///C:/location/"));
the following transformation would result:
  /project/directory/file
    ->
  file:///C:/location/directory/file

Returns:
the resolved URI or null.

handlePlatformResourceOptions

public static java.lang.String[] handlePlatformResourceOptions(java.lang.String[] arguments)
Handles recognized platform resource arguments and returns the stripped result.

Recognized arguments are of this form:

  -platformResource ( <project-name> <file-or-URI> )+
E.g., This these arguments
  -platformResource project file:///C:/location/
will produce this effect:
  EcoreUtil.getPlatformResourceMap().put
    ("project", URI.createURI("file:///C:/location/"));
This mechanism supports relocatable projects outside of Eclipse.

Parameters:
arguments - an array of "command line" options.
Returns:
the arguments stripped of those recognized as platform resource options.

getEPackageNsURIToGenModelLocationMap

public static java.util.Map<java.lang.String,URI> getEPackageNsURIToGenModelLocationMap()
Returns a map from package namespace URI (represented as a String) to the location of the GenModel containing a GenPackage for the package (represented as a URI).

Returns:
a map from package namespace to GenModel location.

computePlatformResourceToPlatformPluginMap

public static java.util.Map<URI,URI> computePlatformResourceToPlatformPluginMap(java.util.Collection<URI> uris)
Computes a map from platform:/resource/<plugin-location>/ URI to platform:/plugin/<plugin-id>/ URI for each URI in the collection of the form platform:/plugin/<plugin-id>/.... This allows each plugin to be treated as if it were a project in the workspace. If the workspace already contains a project for the plugin location, no mapping is produced.

Parameters:
uris - a collections of URIs.
Returns:
a map from platform resource URI to platform plugin URI.

computePlatformPluginToPlatformResourceMap

public static java.util.Map<URI,URI> computePlatformPluginToPlatformResourceMap()
Computes a map from platform:/plugin/<plugin-id>/ URI to platform:/resource/<plugin-location>/ URI for each plugin project in the workspace. This allows each plugin from the runtime to be redirected to its active version in the workspace.

Returns:
a map from plugin URIs to resource URIs.
See Also:
URIConverter.getURIMap(), URI

computePlatformURIMap

public static java.util.Map<URI,URI> computePlatformURIMap()
Computes a map so that plugins in the workspace will override those in the environment and so that plugins with Ecore and GenModels will look like projects in the workspace. It's implemented like this:
  Map result = new HashMap();
  result.putAll(computePlatformPluginToPlatformResourceMap());
  result.putAll(computePlatformResourceToPlatformPluginMap(new HashSet(EcorePlugin.getEPackageNsURIToGenModelLocationMap().values())));
  return result;

Returns:
computes a map so that plugins in the workspace will override those in the environment and so that plugins with Ecore and GenModels will look like projects in the workspace.
See Also:
URIConverter.getURIMap(), URI, computePlatformPluginToPlatformResourceMap(), computePlatformResourceToPlatformPluginMap(Collection)

getDefaultRegistryImplementation

public static EPackage.Registry getDefaultRegistryImplementation()
Returns the default registry implementation singleton.

Returns:
the default registry implementation singleton.

getPlugin

public static EcorePlugin.Implementation getPlugin()
Returns the Eclipse plugin singleton.

Returns:
the plugin singleton.

getWorkspaceRoot

public static IWorkspaceRoot getWorkspaceRoot()
Returns the workspace root, or null, if the runtime environment is stand-alone.

Returns:
the workspace root, or null.

Copyright 2001-2012 IBM Corporation and others.
All Rights Reserved.