Skip to main content



      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 12:01 Go to next message
Eclipse UserFriend
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 12:14 Go to previous messageGo to next message
Eclipse UserFriend
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 12:30 Go to previous messageGo to next message
Eclipse UserFriend
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 03:16] by Moderator

Re: Reload application model at runtime [message #1083131 is a reply to message #1018340] Fri, 09 August 2013 10:12 Go to previous message
Eclipse UserFriend
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: Wed Jul 02 19:55:28 EDT 2025

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

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

Back to the top