Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » how to call a class during eclipse plugin installation?
how to call a class during eclipse plugin installation? [message #1694652] Wed, 06 May 2015 20:43 Go to next message
Rafael Barioni is currently offline Rafael BarioniFriend
Messages: 18
Registered: October 2014
Junior Member
During the install of my plugin in Eclipse, I'd like to call a method to perform some validations. I tried this approach:
http://zeroturnaround.com/rebellabs/how-to-add-custom-install-actions-to-your-next-eclipse-ide-plug-in/

but the class isn´t being called.

Have anyone already tried something like this?
Any help is welcome.

Thanks a lot.
Re: how to call a class during eclipse plugin installation? [message #1694665 is a reply to message #1694652] Thu, 07 May 2015 02:26 Go to previous messageGo to next message
Pascal Rapicault is currently offline Pascal RapicaultFriend
Messages: 333
Registered: July 2009
Location: Ottawa
Senior Member
I recently did this and it worked.
I have not went through the details of the article but it seems to cover the most important points.
A couple things you need to know:
- The action needs to be in the installation before it can be executed. So the first thing I recommend you to do is to develop your action, install it in Eclipse, and then create an IU that uses this action. Either the action is found and it is executed or it fails by saying that the action can't be found.
- The action is loaded from plugin.xml, be sure it is loaded
- Add breakpoints in the p2 engine to to confirm the action is found. For example there is a class that loads the actions from the plugin.xml that may be interesting (sorry don't know the name by heart)
- Then in a real case you will likely want to cause the installation of the action "automatically" when the user installs the software. This can be achieved by having your plug-ins / feature define a meta-requirement on the plugin that delivers the action. This meta requirement will be seen by p2, and will cause the plugin with the action to be installsed before the actual software is installed.
- Meta requirements are specified through the means of p2.inf

HTH
Re: how to call a class during eclipse plugin installation? [message #1694721 is a reply to message #1694665] Thu, 07 May 2015 11:20 Go to previous message
Rafael Barioni is currently offline Rafael BarioniFriend
Messages: 18
Registered: October 2014
Junior Member
Pascal Rapicault wrote on Thu, 07 May 2015 02:26
I recently did this and it worked.
I have not went through the details of the article but it seems to cover the most important points.
A couple things you need to know:
- The action needs to be in the installation before it can be executed. So the first thing I recommend you to do is to develop your action, install it in Eclipse, and then create an IU that uses this action. Either the action is found and it is executed or it fails by saying that the action can't be found.
- The action is loaded from plugin.xml, be sure it is loaded
- Add breakpoints in the p2 engine to to confirm the action is found. For example there is a class that loads the actions from the plugin.xml that may be interesting (sorry don't know the name by heart)
- Then in a real case you will likely want to cause the installation of the action "automatically" when the user installs the software. This can be achieved by having your plug-ins / feature define a meta-requirement on the plugin that delivers the action. This meta requirement will be seen by p2, and will cause the plugin with the action to be installsed before the actual software is installed.
- Meta requirements are specified through the means of p2.inf

HTH


Hello. Thanks for the help.

But it seems that, to achieve this, I need to have 2 separate plugins, correct?
I was trying to create my action class inside my plugin and make the call in the .inf file.

Sorry, but could you send some code to explain better the idea?

Thanks again
Previous Topic:Conflicting Dependency while updating RCP app using p2
Next Topic:Installing RTC P2 eclipse extension on existing 4.3.1 eclipse environment
Goto Forum:
  


Current Time: Tue Mar 19 06:39:25 GMT 2024

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

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

Back to the top