|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.common.EMFPlugin
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 appopriate 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.
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 URL |
baseURL
|
protected ResourceLocator[] |
delegateResourceLocators
|
protected Map |
images
|
static boolean |
IS_ECLIPSE_RUNNING
|
protected ResourceBundle |
resourceBundle
|
protected boolean |
shouldTranslate
|
protected Map |
strings
|
protected ResourceBundle |
untranslatedResourceBundle
|
protected Map |
untranslatedStrings
|
Constructor Summary | |
EMFPlugin(ResourceLocator[] delegateResourceLocators)
|
Method Summary | |
protected Object |
delegatedGetImage(String key)
Does the work of fetching the image associated with the key, when the image resource is not available locally. |
protected String |
delegatedGetString(String key,
boolean translate)
Does the work of fetching the string associated with the key, when the string resource is not available locally. |
protected Object |
doGetImage(String key)
Does the work of fetching the image associated with the key. |
URL |
getBaseURL()
Returns the URL from which all resources are based. |
Object |
getImage(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. |
String |
getString(String key)
Returns the string resource associated with the key. |
String |
getString(String key,
boolean translate)
Returns the string resource associated with the key. |
String |
getString(String key,
Object[] substitutions)
Returns a string resource associated with the key, and peforms substitutions. |
String |
getString(String key,
Object[] substitutions,
boolean translate)
Returns a string resource associated with the key, and peforms substitutions. |
String |
getSymbolicName()
|
void |
log(Object logEntry)
Logs an entry. |
static void |
main(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 |
public static final boolean IS_ECLIPSE_RUNNING
protected ResourceLocator[] delegateResourceLocators
protected URL baseURL
protected ResourceBundle untranslatedResourceBundle
protected ResourceBundle resourceBundle
protected Map strings
protected Map untranslatedStrings
protected boolean shouldTranslate
protected Map images
Constructor Detail |
public EMFPlugin(ResourceLocator[] delegateResourceLocators)
Method Detail |
public abstract ResourceLocator getPluginResourceLocator()
public Logger getPluginLogger()
public String getSymbolicName()
public URL getBaseURL()
ResourceLocator
getBaseURL
in interface ResourceLocator
public Object getImage(String key)
ResourceLocator
getImage
in interface ResourceLocator
key
- the key of the image resource.
protected Object doGetImage(String key) throws IOException
key
- the key of the image to fetch.
IOException
- if an image doesn't exist.protected Object delegatedGetImage(String key) throws MissingResourceException
key
- the key of the image to fetch.
MissingResourceException
- if the image resource doesn't exist anywhere.delegateResourceLocators
public boolean shouldTranslate()
true
if strings should be translated by default; false
otherwise.public void setShouldTranslate(boolean shouldTranslate)
shouldTranslate
- whether strings should be translated by default.public String getString(String key)
ResourceLocator
getString
in interface ResourceLocator
key
- the key of the string resource.
public String getString(String key, boolean translate)
ResourceLocator
getString
in interface ResourceLocator
key
- the key of the string resource.translate
- whether the result is to be translated to the current locale.
protected String delegatedGetString(String key, boolean translate)
key
- the key of the string to fetch.
MissingResourceException
- if the string resource doesn't exist anywhere.delegateResourceLocators
public String getString(String key, Object[] substitutions)
ResourceLocator
getString
in interface ResourceLocator
key
- the key of the string.substitutions
- the message substitutions.
ResourceLocator.getString(String)
,
MessageFormat.format(String, Object[])
public String getString(String key, Object[] substitutions, boolean translate)
ResourceLocator
getString
in interface ResourceLocator
key
- the key of the string.substitutions
- the message substitutions.translate
- whether the result is to be translated to the current locale.
ResourceLocator.getString(String)
,
MessageFormat.format(String, Object[])
public void log(Object logEntry)
Logger
log
in interface Logger
logEntry
- a plastic entry to log.public static void main(String[] args)
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |