Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How to get a plugins class
How to get a plugins class [message #275418] Mon, 08 November 2004 11:05 Go to next message
Eclipse UserFriend
Originally posted by: dhavrda.motive.com

I have a plug-in that will need to access other plugins plug-in class
dynamically. Is there a way to 1) get the class name of a plug-in based on
the plug-in id? 2) is there a way to load the plug-in/class and call a
method on the plug-in?

I have tried Platform.getBundle("plug-in id") and tried bundle.start().
This fails telling me the activator for that plug-in is invalid. What do I
have to do to make the activator valid?

thx
Re: How to get a plugins class [message #275452 is a reply to message #275418] Mon, 08 November 2004 12:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

The plugin class is not always available, nor do all plugins have a
plugin class, nor does the system store the plugin class instances
anywhere. So you can't get the plugin class in a generic way. You can
only access specific plugin classes that you know about it and have been
exposed for access, such as ResourcesPlugin. You can access that one
directly, but there is no way to query to find it.

What do you need to have access to the plugin class for? There are other
ways to get things from bundles.


--
Thanks,
Rich Kulp
Re: How to get a plugins class [message #275456 is a reply to message #275452] Mon, 08 November 2004 13:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dhavrda.motive.com

Well basically I wanted to have a plug-in id in a configuration file for a
"solution". To determine whether or not a feature showed up in a solution
would be determined on if it was declared in the configuration file. I
basically want a plug-in per tree node. Each plug-in/treenode is
responsible for its editors, perspectives, and children etc... So to
determine whether or not a treenode/feature could be shown I wanted to refer
to the plug-in id. So featrure=some.plug-in.id. All plugins would be
required to implement a defined interface to return back its node. All
nodes adhere to an interface and extend a base class. So none of the
specifics need to be known. This way I could drop and pull plugins out of
the project and have them show up in my tree depending on the solution
feature list.
Also the main plug-in (RCP actually) doesn't have to know about all of the
other plugins at design time.

I know it sounds a bit confusing. Do you know of a better way to do this?

thanks,
Dave Havrda


"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:cmobb7$1m5$1@eclipse.org...
> The plugin class is not always available, nor do all plugins have a
> plugin class, nor does the system store the plugin class instances
> anywhere. So you can't get the plugin class in a generic way. You can
> only access specific plugin classes that you know about it and have been
> exposed for access, such as ResourcesPlugin. You can access that one
> directly, but there is no way to query to find it.
>
> What do you need to have access to the plugin class for? There are other
> ways to get things from bundles.
>
>
> --
> Thanks,
> Rich Kulp
Re: How to get a plugins class [message #275460 is a reply to message #275456] Mon, 08 November 2004 13:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Use extension points instead. The extension can provide the id and a
class that you can instantiate from the plugin. (See
IConfigurationElement.createExecutableExtension). This class would be
the node. Each plugin would provide the extension to the extension point
along with an id.

--
Thanks,
Rich Kulp
Re: How to get a plugins class [message #275462 is a reply to message #275460] Mon, 08 November 2004 13:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dhavrda.motive.com

Thanks a whole bunch!

"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:cmoe6k$q7o$1@eclipse.org...
> Use extension points instead. The extension can provide the id and a
> class that you can instantiate from the plugin. (See
> IConfigurationElement.createExecutableExtension). This class would be
> the node. Each plugin would provide the extension to the extension point
> along with an id.
>
> --
> Thanks,
> Rich Kulp
Re: How to get a plugins class [message #275566 is a reply to message #275460] Tue, 09 November 2004 09:56 Go to previous message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Rich Kulp wrote:
> Use extension points instead. The extension can provide the id and a
> class that you can instantiate from the plugin. (See
> IConfigurationElement.createExecutableExtension). This class would be
> the node. Each plugin would provide the extension to the extension point
> along with an id.
>

Yes, and it sounds like he is going to want to create 'features' and not
'plugins'. Not to worry, you can change a plugin into a feature
relatively easy. The difference is a feature can not stand alone and
depends on the presence of another plugin. Which seems to be what you
have described.

--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into
the sheepfold{}, but climbeth up some other *way, the same is a thief
and a robber." John 10:1

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see
http://www.rigidsoftware.com/Chess/chess.html
Previous Topic:Tomcat
Next Topic:Eclipse help/tutorial
Goto Forum:
  


Current Time: Thu Jul 31 15:50:48 EDT 2025

Powered by FUDForum. Page generated in 0.05409 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top