|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A plug-in descriptor contains information about a plug-in
obtained from the plug-in's manifest (plugin.xml
) file.
Plug-in descriptors are platform-defined objects that exist
in the plug-in registry independent of whether a plug-in has
been started. In contrast, a plug-in's runtime object
(getPlugin
) generally runs plug-in-defined code.
This interface is not intended to be implemented by clients.
getPlugin()
Method Summary | |
URL |
find(IPath path)
Returns a URL for the given path. |
URL |
find(IPath path,
Map override)
Returns a URL for the given path. |
IExtension |
getExtension(String extensionName)
Returns the extension with the given simple identifier declared in this plug-in, or null if there is no such extension. |
IExtensionPoint |
getExtensionPoint(String extensionPointId)
Returns the extension point with the given simple identifier declared in this plug-in, or null if there is no such extension point. |
IExtensionPoint[] |
getExtensionPoints()
Returns all extension points declared by this plug-in. |
IExtension[] |
getExtensions()
Returns all extensions declared by this plug-in. |
URL |
getInstallURL()
Returns the URL of this plug-in's install directory. |
String |
getLabel()
Returns a displayable label for this plug-in. |
Plugin |
getPlugin()
Returns the plug-in runtime object corresponding to this plug-in descriptor. |
ClassLoader |
getPluginClassLoader()
Returns the plug-in class loader used to load classes and resources for this plug-in. |
IPluginPrerequisite[] |
getPluginPrerequisites()
Returns a list of plug-in prerequisites required for correct execution of this plug-in. |
String |
getProviderName()
Returns the name of the provider of this plug-in. |
ResourceBundle |
getResourceBundle()
Returns this plug-in's resource bundle for the current locale. |
String |
getResourceString(String value)
Returns a resource string corresponding to the given argument value. |
String |
getResourceString(String value,
ResourceBundle bundle)
Returns a resource string corresponding to the given argument value and bundle. |
ILibrary[] |
getRuntimeLibraries()
Returns all runtime libraries declared by this plug-in. |
String |
getUniqueIdentifier()
Returns the unique identifier of this plug-in. |
PluginVersionIdentifier |
getVersionIdentifier()
Returns the version identifier of this plug-in. |
boolean |
isPluginActivated()
Returns whether the plug-in described by this descriptor has been activated. |
Method Detail |
public IExtension getExtension(String extensionName)
null
if there is no such extension.
Since an extension might not have an identifier, some extensions
can only be found via the getExtensions
method.
extensionName
- the simple identifier of the extension (e.g. "main"
).
null
public IExtensionPoint getExtensionPoint(String extensionPointId)
null
if there is no such extension point.
extensionPointId
- the simple identifier of the extension point (e.g. "wizard"
).
null
public IExtensionPoint[] getExtensionPoints()
public IExtension[] getExtensions()
public URL getInstallURL()
public String getLabel()
Note that any translation specified in the plug-in manifest file is automatically applied.
getResourceString(java.lang.String)
public Plugin getPlugin() throws CoreException
CoreException
- if this plug-in's runtime object could not be created.isPluginActivated()
public ClassLoader getPluginClassLoader()
The following examples illustrate the direct use of the plug-in class loader and its effect on plug-in activation (example ignores error handling).
ClassLoader loader = descriptor.getPluginClassLoader(); // Load resource by name. Will not activate the plug-in. URL res = loader.getResource("com/example/Foo/button.gif"); InputStream is = loader.getResourceAsStream("splash.jpg"); // Load resource for class. Will activate the plug-in because // the referenced class is loaded first and triggers activation. URL u = com.example.Foo.class.getResource("button.gif"); // Load class by name. Will activate the plug-in. Class c = loader.loadClass("com.example.Bar"); // Load a resource bundle. May, or may not activate the plug-in, depending // on the bundle implementation. If implemented as a class, the plug-in // will be activated. If implemented as a properties file, the plug-in will // not be activated. ResourceBundle b = ResourceBundle.getBundle("bundle", Locale.getDefault(), loader);
IConfigurationElement.createExecutableExtension(java.lang.String)
,
isPluginActivated()
,
getResourceBundle()
public IPluginPrerequisite[] getPluginPrerequisites()
public String getProviderName()
Note that any translation specified in the plug-in manifest file is automatically applied.
getResourceString(java.lang.String)
public ResourceBundle getResourceBundle() throws MissingResourceException
The bundle is stored as the plugin.properties
file
in the plug-in install directory, and contains any translatable
strings used in the plug-in manifest file (plugin.xml
)
along with other resource strings used by the plug-in implementation.
MissingResourceException
- if the resource bundle was not foundpublic String getResourceString(String value)
Equivalent to getResourceString(value, getBundle())
value
- the value
getResourceBundle()
public String getResourceString(String value, ResourceBundle bundle)
For example, assume resource bundle plugin.properties contains name = Project Name
getResourceString("Hello World") returns "Hello World" getResourceString("%name") returns "Project Name" getResourceString("%name Hello World") returns "Project Name" getResourceString("%abcd Hello World") returns "Hello World" getResourceString("%abcd") returns "%abcd" getResourceString("%%name") returns "%name"
value
- the valuebundle
- the resource bundle
getResourceBundle()
public ILibrary[] getRuntimeLibraries()
public String getUniqueIdentifier()
"org.eclipse.core.runtime"
)public PluginVersionIdentifier getVersionIdentifier()
public boolean isPluginActivated()
true
if this plug-in is activated, and
false
otherwisegetPlugin()
public URL find(IPath path)
null
if the URL
could not be computed or created.
null
It is not
necessary to perform a 'resolve' on this URL.public URL find(IPath path, Map override)
null
if the URL
could not be computed or created.
find will look for this path under the directory structure for this plugin
and any of its fragments. If this path will yield a result outside the
scope of this plugin, null
will be returned. Note that
there is no specific order to the fragments.
The following arguments may also be used
$nl$ - for language specific information
$os$ - for operating system specific information
$ws$ - for windowing system specific information
A path of $nl$/about.properties in an environment with a default
locale of en_CA will return a URL corresponding to the first place
about.properties is found according to the following order:
plugin root/nl/en/CA/about.properties
fragment1 root/nl/en/CA/about.properties
fragment2 root/nl/en/CA/about.properties
...
plugin root/nl/en/about.properties
fragment1 root/nl/en/about.properties
fragment2 root/nl/en/about.properties
...
plugin root/about.properties
fragment1 root/about.properties
fragment2 root/about.properties
...
If a locale other than the default locale is desired, use an
override map.
path
- file path relative to plug-in installation locationoverride
- map of override substitution arguments to be used for
any $arg$ path elements. The map keys correspond to the substitution
arguments (eg. "$nl$" or "$os$"). The resulting
values must be of type java.lang.String. If the map is null
,
or does not contain the required substitution argument, the default
is used.
null
. It is not
necessary to perform a 'resolve' on this URL.
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |