Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Handler not created when running a product outside of the IDE(Different behavior in IDE and product?)
Handler not created when running a product outside of the IDE [message #1698740] Wed, 17 June 2015 14:38 Go to next message
Guenther Mahr is currently offline Guenther MahrFriend
Messages: 25
Registered: September 2011
Junior Member
Hi,

I added a handler definition to my application model and when I start the application in the IDE this handler is created as it should (during the creation of the workbench before the UI parts). But when I start the product outside of the IDE the handler is not created (I verified this by a log statement in its constructor and also by checking the workbench context). Because of this my application fails.
Any ideas?

Thanks,
Günther
Re: Handler not created when running a product outside of the IDE [message #1698745 is a reply to message #1698740] Wed, 17 June 2015 14:50 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 653
Registered: January 2012
Senior Member

You haven't said how you're installing this handler, whether it's (1) with a fragment, (2) via a model processor, or (3) an E3.x handler via the org.eclipse.ui.handlers extension point. Verify that your bundle is actually enabled -- perhaps you have a missing dependency. If (1) or (2) then you can hook your app up with the debugger and put some breakpoints in the ModelAssembler to see how things progress.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: Handler not created when running a product outside of the IDE [message #1698909 is a reply to message #1698745] Thu, 18 June 2015 17:00 Go to previous messageGo to next message
Guenther Mahr is currently offline Guenther MahrFriend
Messages: 25
Registered: September 2011
Junior Member
Hi Brian,

Thanks for the tip with the remote debugging!

I found out now that for some strange reason only 8 of my 15 specified handlers get loaded in the startup of the product whereas running the same thing in the IDE loads all 15! (I verified this at the end of E4Application.loadApplicationModel()).

It's a pure E4 application and I specify these handlers in the Application Model itself, not in a fragment.

There's no question that I use the same plug-ins in both cases. The product is built by a Jenkins/Maven job and I controlled that I used the latest version. And I've been using the same product definition already for some time without any problems.

Must be something completely stupid!

Günther
Re: Handler not created when running a product outside of the IDE [message #1698910 is a reply to message #1698909] Thu, 18 June 2015 17:17 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 653
Registered: January 2012
Senior Member

Hi Günther.

Verify that the bundles are set to be lazily activated (MANIFEST.MF contains "Bundle-ActivationPolicy: lazy"). Your PDE Launch Configuration may start your bundles by default, which isn't the case when deploying as a product. See the following for more details:

https://wiki.eclipse.org/Lazy_Start_Bundles

Build your app with the OSGi Console and use the 'diag' command to see why the bundles are not being activated. See the following page for more details:

https://wiki.eclipse.org/Where_Is_My_Bundle

Hope that helps.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: Handler not created when running a product outside of the IDE [message #1698948 is a reply to message #1698910] Fri, 19 June 2015 06:43 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2495
Registered: July 2012
Senior Member
Are you using field injection in your handlers? In that case the creation might fail because the dependencies can not be resolved at creation time.
Re: Handler not created when running a product outside of the IDE [message #1699037 is a reply to message #1698948] Fri, 19 June 2015 16:50 Go to previous message
Guenther Mahr is currently offline Guenther MahrFriend
Messages: 25
Registered: September 2011
Junior Member
Thanks a lot everybody, but it's not that!

I use lazy-initialization in all of my bundles and I also checked that the problem has nothing to do with injection.

What I first found out was that for some reason the 8 handlers that were instantiated in the product were specified in workspace\.metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi
but that my missing not-instantiated handlers were not specified there.

Whereas in my IDE workspace the same file workbench.xmi looked very different and I saw my missing handlers (even though in other contexts).

What I forgot to mention is that my product is updated via an update site - it has not been completely replaced for a while, just updated (which worked so far). Now I replaced the product completely and
everything works again as it should. The workbench.xmi file now contains all of my 15 handlers and all of them are instantiated at startup.

So far so good - problem solved, but the question remains: why was that workbench.xmi - file not updated correctly even though the regular updates via the update site seemed to work normally.

Günther






[Updated on: Fri, 19 June 2015 17:04]

Report message to a moderator

Previous Topic:CSS Spy throws IllegalArgumentException
Next Topic:Re-compile Eclipse Error
Goto Forum:
  


Current Time: Sun Sep 24 01:34:46 GMT 2017

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

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