[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: publishing extension points - help!

Extension points can only be defined ("created") through the plugin.xml. The plugin registry
is constructed by the platform runtime based on the declarations contained in the various
plugins. The Java API only provides methods to access this information (r/o).

Judah Diament wrote:

> Vlad,
>
> That is very usefull, but it doesn;t really answer my question. I saw in the API docs how
> to access the registry to see what plugind are around for a given extension point. What I
> didn;t see is how to CREATE a new extension point. That is, are extnesion points ONLY
> declared in plugin.xml, or do you also have to do some java to create a new extension
> point?
>
> Thanks,
> Judah
>
> Vlad Klicnik wrote:
>
> > Judah, the way you do this is by calling APIs in the
> > org.eclipse.core.runtime package. In particular, the following are useful
> >
> > Platform.getPluginRegistry()
> > IPluginRegistry.getXXX ... various calls to get descriptors for plugins,
> > extension points, extensions, etc
> > methods on IPluginDescriptor, IExtension, IExtensionPoint,
> > IConfigurationElement
> >
> > So to find out which items were configured into your extension point
> > "com.xyz.myplugin.foopoint" by some other plugin extensions you could do
> >
> > IConfigurationElement[] cfg;
> > cfg =
> > Platform.getPluginRegistry().getConfigurationElementsFor("com.xyz.myplugin.foopoint");
> >
> > To actually interact with one of the extensions (eg. with the first one in
> > the list returned above) you could then call
> >
> > IFoo someFoo = (IFoo) cfg[0].createExecutableExtension("fooclass");
> >
> > and once you have your object you are off to the races (see the javadoc for
> > explanation of the arguments). The idea is that others have plugged in
> > extensions that define classes implementing your IFoo interface (required by
> > the extension point) so you actually know how to interact with the resulting
> > object.
> >
> > Also, see Help> Help Contents and select Platform Plug-In Developer Guide
> > from the drop box.
> >
> > Hope this helps you get going.