org.eclipse.emf.ecore.plugin
Class EcorePlugin

java.lang.Object
  |
  +--org.eclipse.emf.ecore.plugin.EcorePlugin

public class EcorePlugin
extends java.lang.Object

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


Inner Class Summary
static class EcorePlugin.Implementation
          A plugin implementation that handles Ecore plugin registration.
 
Constructor Summary
EcorePlugin()
           
 
Method Summary
static java.util.Map getPlatformResourceMap()
          Returns the platform resource map.
static EcorePlugin.Implementation getPlugin()
          Returns the Eclipse plugin singleton.
static org.eclipse.core.resources.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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EcorePlugin

public EcorePlugin()
Method Detail

getPlatformResourceMap

public static java.util.Map 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, interpretted 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.

getPlugin

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

getWorkspaceRoot

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

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