[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: How can I pre-req an Optional plugin?
|
- From: "Randy Hudson" <none@xxxxxxx>
- Date: Thu, 13 Sep 2001 15:46:39 -0400
- Newsgroups: eclipse.tools
- Organization: EclipseCorner
Actually, this would work perfectly, since we need
just an Object.
This is very similar to the way the ContentOutline
asks for a ContentOutlinePage.
Imagine that the ContentOutline itself were a view
that you wished to ship ONLY
to ISVs developing in Eclipse, and not in the final
product. Therefore, you put that
View and its default page in its own plugin, which
you provide to ISVs only.
class MyEditorPartInPluginB
implements
IAdaptable
{
...
public Object getAdapter(Class
adapterKey){
//The type constant was set
previously using the method described previously
if (adapterKey =
TYPE_pageDefinedInPluginA)
return
constructorForSaidType.newInstance(parameter1);
//Ignoring possible exceptoins
thrown.
...
}
...
}
> I was wondering what you
cast the newly created instance of "foo" to. If you
> don't have any
compile time dependencies on "foo", it looks to me as if "foo"
> should
actually plugin into an extension point that plugin B should define.
>
Sorry Peter, but the classloader thing just looks a bit hacky.
>
>
Thomas
>
> Peter Amhof wrote:
>
> > I would do it
like this:
> >
> > // first get plugin A by it's id (should be
it's folder name?)
> > Plugin aPlugin=
org.eclipse.core.runtime.Platform.getPlugin(String
> >
pluginID);
> > if (aPlugin == null) return; //
plugin A not installed
> > ClassLoader loader=
aPlugin.getDescriptor().getPluginClassLoader();
> > Class aClass=
loader.loadClass(myClassName);
> >
> > mfg feser aka peter
paul amhof
> >
> > "Randy Hudson" <none@xxxxxxx> schrieb im Newsbeitrag
> > news:9noceg$9om$1@xxxxxxxxxxxxx...
> > > How can I have Plugin B pre-req Plugin A, but also
no care if Plugin A is
> > > not installed. For example, we
are trying to dynamically find a class by
> > > using
Class.forName("foo") to see if a class from Plugin A is around. If
>
> it
> > > is, great, and we will then instantiate that class
foo. If not, we don't
> > > care.
> > >
>
> > Currently Plugin B is getting deactiviated if Plugin A is not
found.
> > >
> > >
>