Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Reload application model at runtime(Is it possible?)
Reload application model at runtime [message #1018324] Wed, 13 March 2013 16:01 Go to next message
Matthias Renz is currently offline Matthias Renz
Messages: 3
Registered: March 2013
Junior Member
Hi,

I wrote my own IModelResourceHandler implementation to load the application.e4xmi from a database at startup. But, is there a possibility to replace the application model at runtime?
I tried the following code, but it leads to a NullPointerException:


IPresentationEngine engine = ..
IModelResourceHandler handler = ..
Resource resource = handler.loadMostRecentModel();
MApplication reloadedApp = (MApplication) resource.getContents().get(0);
engine.run(reloadedApp, context);




Is there a better way to do this or is it generally impossible?

Best regards
Matthias
Re: Reload application model at runtime [message #1018332 is a reply to message #1018324] Wed, 13 March 2013 16:14 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5423
Registered: July 2009
Senior Member
it would definately help to see the NPE. I'm not sure but I don't see
you setting the IEclipseContext for the MApplication-Element!

I think the correct approach would be anyways to create a new instance
of E4Workbench and tear down the old one. The problem I see is that if
you tear down the first E4Workbench the Equinox-Application exit, so you
probably need to write your own E4Application.

Might I ask why you are not simply restarting the whole application?

Tom

Am 13.03.13 17:05, schrieb Matthias Renz:
> Hi,
>
> I wrote my own IModelResourceHandler implementation to load the
> application.e4xmi from a database at startup. But, is there a
> possibility to replace the application model at runtime?
> I tried the following code, but it leads to a NullPointerException:
>
>
>
> IPresentationEngine engine = ..
> IModelResourceHandler handler = ..
> Resource resource = handler.loadMostRecentModel();
> MApplication reloadedApp = (MApplication) resource.getContents().get(0);
> engine.run(reloadedApp, context);
>
>
>
>
> Is there a better way to do this or is it generally impossible?
>
> Best regards
> Matthias
Re: Reload application model at runtime [message #1018340 is a reply to message #1018332] Wed, 13 March 2013 16:30 Go to previous messageGo to next message
Matthias Renz is currently offline Matthias Renz
Messages: 3
Registered: March 2013
Junior Member
Thank you very much, Thomas!
I forgot to set the IEclipseContext to the new application object.

Now, the thing is that a new shell is being opened. I think I must close the old window referencing the old application model.
I have no Idea, how to dispose the old model and close its window.

IPersistanceEngine.removeGui() has no effect.

How can I do that?

[Updated on: Thu, 14 March 2013 07:16]

Report message to a moderator

Re: Reload application model at runtime [message #1083131 is a reply to message #1018340] Fri, 09 August 2013 14:12 Go to previous message
x545 x545 is currently offline x545 x545
Messages: 6
Registered: July 2009
Junior Member
I have the same problem here!
Did you get it working? Can you direct me to a solution?

Sandro
Previous Topic:Open perspective
Next Topic:DI in activator with Compatibility layer
Goto Forum:
  


Current Time: Sun Oct 26 07:46:16 GMT 2014

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

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