public class EcorePlugin extends EMFPlugin
Modifier and Type | Class and Description |
---|---|
static class |
EcorePlugin.ExtensionProcessor
A class containing a single utility method for processing extensions.
|
static class |
EcorePlugin.Implementation
A plugin implementation that handles Ecore plugin registration.
|
EMFPlugin.EclipsePlugin, EMFPlugin.InternalEclipsePlugin, EMFPlugin.InternalHelper, EMFPlugin.OSGiDelegatingBundleActivator
Modifier and Type | Field and Description |
---|---|
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 |
delegateResourceLocators, IS_ECLIPSE_RUNNING, IS_RESOURCES_BUNDLE_AVAILABLE
baseURL, images, resourceBundle, shouldTranslate, strings, untranslatedResourceBundle, untranslatedStrings
Modifier and Type | Method and Description |
---|---|
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 or platform resource map . |
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()
Deprecated.
since 2.9;
use
computePlatformURIMap(true)
to get the mappings for the target platform,
or use computePlatformURIMap(false) to get the legacy behavior, i.e., the mappings for the installed environment.
It's generally expected that all clients, will migrate to use the target platform. |
static java.util.Map<URI,URI> |
computePlatformURIMap(boolean targetPlatform)
Computes a map so that plugins in the workspace will override those in the target platform or the environment
and so that plugins with Ecore and GenModels in the target platform or the environment will look like projects in the workspace,
i.e., so that each plugin can be accessed via a logical
platform:/resource URI
equivalent to what would be used if the plugin were actually imported into the workspace. |
static EPackage.Registry |
getDefaultRegistryImplementation()
Returns the default registry implementation singleton.
|
static java.util.Map<java.lang.String,URI> |
getEPackageNsURIToGenModelLocationMap()
Deprecated.
since 2.9;
use
getEPackageNsURItoGenModelLocationMap(true)
to get the locations in the target platform,
or use getEPackageNsURItoGenModelLocationMap(false) to get the legacy behavior, i.e., the locations in the installed environment.
It's generally expected that all clients, will migrate to use the target platform. |
static java.util.Map<java.lang.String,URI> |
getEPackageNsURIToGenModelLocationMap(boolean targetPlatform)
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 )
for either the target platform or the environment itself. |
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.
|
java.lang.String |
getSymbolicName() |
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. |
getDelegateResourceLocators, getPluginLogger, getPrimaryResourceLocator, log, main
delegatedGetImage, delegatedGetString, doGetImage, doGetString, extensionFor, getBaseURL, getImage, getString, getString, getString, getString, setShouldTranslate, shouldTranslate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBaseURL, getImage, getString, getString, getString, getString
public static final EcorePlugin INSTANCE
public static final java.lang.String DYNAMIC_PACKAGE_PPID
public static final java.lang.String GENERATED_PACKAGE_PPID
public static final java.lang.String FACTORY_OVERRIDE_PPID
public static final java.lang.String EXTENSION_PARSER_PPID
public static final java.lang.String PROTOCOL_PARSER_PPID
public static final java.lang.String CONTENT_PARSER_PPID
public static final java.lang.String CONTENT_HANDLER_PPID
public static final java.lang.String SCHEME_PARSER_PPID
public static final java.lang.String URI_MAPPING_PPID
public static final java.lang.String PACKAGE_REGISTRY_IMPLEMENTATION_PPID
public static final java.lang.String VALIDATION_DELEGATE_PPID
public static final java.lang.String SETTING_DELEGATE_PPID
public static final java.lang.String INVOCATION_DELEGATE_PPID
public static final java.lang.String QUERY_DELEGATE_PPID
public static final java.lang.String CONVERSION_DELEGATE_PPID
public ResourceLocator getPluginResourceLocator()
EMFPlugin
getPluginResourceLocator
in class EMFPlugin
public static java.util.Map<java.lang.String,URI> getPlatformResourceMap()
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 org.eclipse.core.resources.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.
resolvePlatformResourcePath(java.lang.String)
public static URI resolvePlatformResourcePath(java.lang.String platformResourcePath)
"/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
null
.public static java.lang.String[] handlePlatformResourceOptions(java.lang.String[] arguments)
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.
arguments
- an array of "command line" options.@Deprecated public static java.util.Map<java.lang.String,URI> getEPackageNsURIToGenModelLocationMap()
getEPackageNsURItoGenModelLocationMap(true)
to get the locations in the target platform,
or use getEPackageNsURItoGenModelLocationMap(false)
to get the legacy behavior, i.e., the locations in the installed environment.
It's generally expected that all clients, will migrate to use the target platform.package namespace URI
(represented as a String)
to the location of the GenModel containing a GenPackage for the package (represented as a URI
).
It's implemented like this:
return getEPackageNsURIToGenModelLocationMap(false);
public static java.util.Map<java.lang.String,URI> getEPackageNsURIToGenModelLocationMap(boolean targetPlatform)
package namespace URI
(represented as a String)
to the location of the GenModel containing a GenPackage for the package (represented as a URI
)
for either the target platform or the environment itself.
If there is no target platform, i.e., if the PDE is not installed, it defaults back to the environment.
It's generally expected that an application using these URIs will also register
the mappings returned by computePlatformURIMap(boolean)
.targetPlatform
- whether to get locations for the target platform or for the environment itself; the former is preferred.computePlatformURIMap(boolean)
public static java.util.Map<URI,URI> computePlatformResourceToPlatformPluginMap(java.util.Collection<URI> uris)
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 or platform resource map
already contains a project for the plugin location, no such mapping is produced.
In addition, when running stand alone and after invoking extension processing
,
mappings from platform:/plugin/<plugin-id>/
to the physical location of the plugin's archive or root folder are produced.
This allows the URIs to be loaded from their proper physical location.uris
- a collections of URI
s.public static java.util.Map<URI,URI> computePlatformPluginToPlatformResourceMap()
platform:/plugin/<plugin-id>/
URI
to
platform:/resource/<plugin-location>/
URI
for each plugin project in the workspace or platform resource map
.
This allows each plugin from the runtime to be redirected
to its active version in the workspace or platform resource map.URIConverter.getURIMap()
,
URI
@Deprecated public static java.util.Map<URI,URI> computePlatformURIMap()
computePlatformURIMap(true)
to get the mappings for the target platform,
or use computePlatformURIMap(false)
to get the legacy behavior, i.e., the mappings for the installed environment.
It's generally expected that all clients, will migrate to use the target platform.return computePlatformURIMap(false);
URIConverter.getURIMap()
,
computePlatformPluginToPlatformResourceMap()
,
computePlatformResourceToPlatformPluginMap(Collection)
public static java.util.Map<URI,URI> computePlatformURIMap(boolean targetPlatform)
platform:/resource
URI
equivalent to what would be used if the plugin were actually imported into the workspace.
If there is no target platform, i.e., if the PDE is not installed, it defaults back to the environment
as if targetPlatform
were false
.
If targetPlatform
is false
, it's computed from the environment like this:
result.putAll(computePlatformPluginToPlatformResourceMap()); result.putAll(computePlatformResourceToPlatformPluginMap(new HashSetIf(EcorePlugin.getEPackageNsURIToGenModelLocationMap(false).values())));
targetPlatform
is true
, it does essentially the same logical thing,
however, it uses the PDE's target platform to determine the available plugins rather than the environment.
The essential difference being that it produces results based on the physical location of all the non-workspace plugins in the PDE's target platform,
rather than based on platform:/plugin
URIs
that always refer to plugins in the running environment.
For example, suppose there is a jarred plugin with ID org.example.model
in the target platform but not in the workspace
that registers a generated model's GenModel at location model/Example.genmodel
,
the mapping from platform:/resource/org.example.model/
to archive:file:/<location-of-plugin-jar>!/
is produced.
If instead that same plugin were actually in the workspace,
the mapping from platform:/plugin/org.example.model/
to platform/resource/org.example.model/
would be produced.
The expected usage of this API is to initialize a resource set's URI converter's URIConverter.getURIMap()
as follows:
resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));This is particularly important when working with Ecore and GenModel resources because they often have references to models in the environment.
targetPlatform
- whether to compute locations for the target platform or for the environment itself; the former is preferred.URIConverter.getURIMap()
,
computePlatformPluginToPlatformResourceMap()
,
computePlatformResourceToPlatformPluginMap(Collection)
,
getEPackageNsURIToGenModelLocationMap(boolean)
public java.lang.String getSymbolicName()
getSymbolicName
in class EMFPlugin
public static EPackage.Registry getDefaultRegistryImplementation()
public static EcorePlugin.Implementation getPlugin()
public static IWorkspaceRoot getWorkspaceRoot()
null
, if the runtime environment is stand-alone.null
.