## org.eclipse.emf.common
Class EMFPlugin

    java.lang.Object
      org.eclipse.emf.common.EMFPlugin

All Implemented Interfaces:
  Logger, ResourceLocator

Direct Known Subclasses:
  ChangeEditPlugin, ChangePlugin, CodeGenEcorePlugin, CodeGenPlugin, CommonPlugin, CommonUIPlugin, ConverterPlugin, Ecore2EcoreEditorPlugin, Ecore2EcorePlugin, Ecore2XMLUIPlugin, EcoreEditorPlugin, EcoreEditPlugin, EcoreImporterPlugin, EcorePlugin, EMFEditPlugin, EMFEditUIPlugin, ExporterPlugin, GenModelEditPlugin, ImporterPlugin, JavaImporterPlugin, MappingPlugin, RoseImporterPlugin, XMIPlugin

    public abstract class EMFPlugin

extends java.lang.Object
implements ResourceLocator, Logger

EMF must run within an Eclipse workbench, within a headless Eclipse workspace, or just stand-alone as part of some other application. To support this, all resource access (e.g., NL strings, images, and so on) is directed to the resource locator methods, which can redirect the service as appropriate to the runtime. During Eclipse invocation, the implementation delegates to a plugin implementation. During stand-alone invocation, no plugin initialization takes place, so the implementation delegates to a resource JAR on the CLASSPATH. The resource jar will typically not be on the CLASSPATH during Eclipse invocation. It will contain things like the icons and the .properties, which are available in a different way during Eclipse invocation.

See Also:
  `ResourceLocator`, `Logger`

Nested Class Summary
`static class` `EMFPlugin.EclipsePlugin` The actual implementation of an Eclipse Plugin.
`static interface` `EMFPlugin.InternalEclipsePlugin` This just provides a common interface for the Eclipse plugins supported by EMF.
`static class` `EMFPlugin.InternalHelper` This just provides a common delegate for non-UI and UI plug-in classes.

Field Summary
`protected java.net.URL` `baseURL`
`protected ResourceLocator[]` `delegateResourceLocators`
`protected java.util.Map<java.lang.String,java.lang.Object>` `images`
`static boolean` `IS_ECLIPSE_RUNNING`
`static boolean` `IS_RESOURCES_BUNDLE_AVAILABLE`
`protected java.util.ResourceBundle` `resourceBundle`
`protected boolean` `shouldTranslate`
`protected java.util.Map<java.lang.String,java.lang.String>` `strings`
`protected java.util.ResourceBundle` `untranslatedResourceBundle`
`protected java.util.Map<java.lang.String,java.lang.String>` `untranslatedStrings`

Constructor Summary
`EMFPlugin(ResourceLocator[] delegateResourceLocators)`

Method Summary
`protected java.lang.Object` `delegatedGetImage(java.lang.String key)` Does the work of fetching the image associated with the key, when the image resource is not available locally.
`protected java.lang.String` `delegatedGetString(java.lang.String key, boolean translate)` Does the work of fetching the string associated with the key, when the string resource is not available locally.
`protected java.lang.Object` `doGetImage(java.lang.String key)` Does the work of fetching the image associated with the key.
`java.net.URL` `getBaseURL()` Returns the URL from which all resources are based.
`java.lang.Object` `getImage(java.lang.String key)` Returns the description that can be used to create the image resource associated with the key.
`Logger` `getPluginLogger()` Returns an Eclipse plugin implementation of a logger.
`abstract ResourceLocator` `getPluginResourceLocator()` Returns an Eclipse plugin implementation of a resource locator.
`java.lang.String` `getString(java.lang.String key)` Returns the string resource associated with the key.
`java.lang.String` `getString(java.lang.String key, boolean translate)` Returns the string resource associated with the key.
`java.lang.String` `getString(java.lang.String key, java.lang.Object[] substitutions)` Returns a string resource associated with the key, and performs substitutions.
`java.lang.String` `getString(java.lang.String key, java.lang.Object[] substitutions, boolean translate)` Returns a string resource associated with the key, and performs substitutions.
`java.lang.String` `getSymbolicName()`
`void` `log(java.lang.Object logEntry)` Logs an entry.
`static void` `main(java.lang.String[] args)`
`void` `setShouldTranslate(boolean shouldTranslate)` Sets whether strings should be translated by default.
`boolean` `shouldTranslate()` Indicates whether strings should be translated by default.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### IS_ECLIPSE_RUNNING

    public static final boolean IS_ECLIPSE_RUNNING

### IS_RESOURCES_BUNDLE_AVAILABLE

    public static final boolean IS_RESOURCES_BUNDLE_AVAILABLE

### delegateResourceLocators

    protected ResourceLocator[] delegateResourceLocators

### baseURL

    protected java.net.URL baseURL

### untranslatedResourceBundle

    protected java.util.ResourceBundle untranslatedResourceBundle

### resourceBundle

    protected java.util.ResourceBundle resourceBundle

### strings

    protected java.util.Map<java.lang.String,java.lang.String> strings

### untranslatedStrings

    protected java.util.Map<java.lang.String,java.lang.String> untranslatedStrings

### shouldTranslate

    protected boolean shouldTranslate

### images

    protected java.util.Map<java.lang.String,java.lang.Object> images

Constructor Detail

### EMFPlugin

    public EMFPlugin(ResourceLocator[] delegateResourceLocators)

Method Detail

### getPluginResourceLocator

    public abstract ResourceLocator getPluginResourceLocator()

  Returns an Eclipse plugin implementation of a resource locator.

  Returns:
    an Eclipse plugin implementation of a resource locator.

### getPluginLogger

    public Logger getPluginLogger()

  Returns an Eclipse plugin implementation of a logger.

  Returns:
    an Eclipse plugin implementation of a logger.

### getSymbolicName

    public java.lang.String getSymbolicName()

### getBaseURL

    public java.net.URL getBaseURL()

  Description copied from interface: `ResourceLocator`
  Returns the URL from which all resources are based.

  Specified by:
    `getBaseURL` in interface `ResourceLocator`
  Returns:
    the URL from which all resources are based.

### getImage

    public java.lang.Object getImage(java.lang.String key)

  Description copied from interface: `ResourceLocator`
  Returns the description that can be used to create the image resource associated with the key. The description will typically be in the form of a URL to the image data. Creation of an actual image depends on the GUI environment; within Eclipse, org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry can be used.

  Specified by:
    `getImage` in interface `ResourceLocator`
  Parameters:
    `key` - the key of the image resource.
  Returns:
    the description on the image resource.

### doGetImage

    protected java.lang.Object doGetImage(java.lang.String key)
                                   throws java.io.IOException

  Does the work of fetching the image associated with the key. It ensures that the image exists.

  Parameters:
    `key` - the key of the image to fetch.
  Returns:
    the description of the image associated with the key.
  Throws:
    `java.io.IOException` - if an image doesn't exist.

### delegatedGetImage

    protected java.lang.Object delegatedGetImage(java.lang.String key)
                                          throws java.util.MissingResourceException

  Does the work of fetching the image associated with the key, when the image resource is not available locally.

  Parameters:
    `key` - the key of the image to fetch.
  Throws:
    `java.util.MissingResourceException` - if the image resource doesn't exist anywhere.
  See Also:
    `delegateResourceLocators`

### shouldTranslate

    public boolean shouldTranslate()

  Indicates whether strings should be translated by default.

  Returns:
    `true` if strings should be translated by default; `false` otherwise.

### setShouldTranslate

    public void setShouldTranslate(boolean shouldTranslate)

  Sets whether strings should be translated by default.

  Parameters:
    `shouldTranslate` - whether strings should be translated by default.

### getString

    public java.lang.String getString(java.lang.String key)

  Description copied from interface: `ResourceLocator`
  Returns the string resource associated with the key.

  Specified by:
    `getString` in interface `ResourceLocator`
  Parameters:
    `key` - the key of the string resource.
  Returns:
    the string resource associated with the key.

### getString

    public java.lang.String getString(java.lang.String key,
                                      boolean translate)

  Description copied from interface: `ResourceLocator`
  Returns the string resource associated with the key.

  Specified by:
    `getString` in interface `ResourceLocator`
  Parameters:
    `key` - the key of the string resource.
    `translate` - whether the result is to be translated to the current locale.
  Returns:
    the string resource associated with the key.

### delegatedGetString

    protected java.lang.String delegatedGetString(java.lang.String key,
                                                  boolean translate)

  Does the work of fetching the string associated with the key, when the string resource is not available locally.

  Parameters:
    `key` - the key of the string to fetch.
  Throws:
    `java.util.MissingResourceException` - if the string resource doesn't exist anywhere.
  See Also:
    `delegateResourceLocators`

### getString

    public java.lang.String getString(java.lang.String key,
                                      java.lang.Object[] substitutions)

  Description copied from interface: `ResourceLocator`
  Returns a string resource associated with the key, and performs substitutions.

  Specified by:
    `getString` in interface `ResourceLocator`
  Parameters:
    `key` - the key of the string.
    `substitutions` - the message substitutions.
  Returns:
    a string resource associated with the key.
  See Also:
    `ResourceLocator.getString(String)`, `MessageFormat.format(String, Object[])`

### getString

    public java.lang.String getString(java.lang.String key,
                                      java.lang.Object[] substitutions,
                                      boolean translate)

  Description copied from interface: `ResourceLocator`
  Returns a string resource associated with the key, and performs substitutions.

  Specified by:
    `getString` in interface `ResourceLocator`
  Parameters:
    `key` - the key of the string.
    `substitutions` - the message substitutions.
    `translate` - whether the result is to be translated to the current locale.
  Returns:
    a string resource associated with the key.
  See Also:
    `ResourceLocator.getString(String)`, `MessageFormat.format(String, Object[])`

### log

    public void log(java.lang.Object logEntry)

  Description copied from interface: `Logger`
  Logs an entry.

  Specified by:
    `log` in interface `Logger`
  Parameters:
    `logEntry` - a plastic entry to log.

### main

    public static void main(java.lang.String[] args)

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