Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Check model instances when run-time environment is loading
Check model instances when run-time environment is loading [message #1768423] Tue, 18 July 2017 13:56 Go to next message
Konstantinos Raptis is currently offline Konstantinos RaptisFriend
Messages: 7
Registered: January 2017
Junior Member
Hello,

I would like to do some checks in my model instances when the run-time environment or my RCP is loading.
Currently I using an adapter and I check for notifications.
However, I would like to do all the checks at once when all model instances are created.
Is there any way to check when all instances are created?
Can I create a function that is being executed just before the run-time environment or the RCP is open?

thanks in advance,
Kostas
Re: Check model instances when run-time environment is loading [message #1768451 is a reply to message #1768423] Tue, 18 July 2017 21:48 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 840
Registered: July 2009
Senior Member
Not sure what you are talking about, but you can try org.eclipse.ui.IStartup and org.eclipse.ui.startup extension point (Eclipse 3.x) or a model processor that listens to the startup event (Eclipse 4.x).

Konstantinos Raptis wrote on Tue, 18 July 2017 15:56
Hello,

I would like to do some checks in my model instances when the run-time environment or my RCP is loading.
Currently I using an adapter and I check for notifications.
However, I would like to do all the checks at once when all model instances are created.
Is there any way to check when all instances are created?
Can I create a function that is being executed just before the run-time environment or the RCP is open?

thanks in advance,
Kostas

Re: Check model instances when run-time environment is loading [message #1768461 is a reply to message #1768451] Wed, 19 July 2017 06:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29112
Registered: July 2009
Senior Member
I'm not sure what you mean either. I assume you're not talking about the model that's opened in some editor but rather some model that you load in order to drive the overall runtime/environment application. An editor you can generate to support live validation (the Editor Decoration property set to Love) and that will automatically trigger the checking of all model constraints when the editor is loaded. If it's some other scenario, presumably you create a resource set and load models into it. That place in the code would be where to add logic for additional checking...

And no, you can't generally monitor (listen to) the creation of all instances by the factory of the model...
Re: Check model instances when run-time environment is loading [message #1768491 is a reply to message #1768423] Wed, 19 July 2017 13:03 Go to previous messageGo to next message
Konstantinos Raptis is currently offline Konstantinos RaptisFriend
Messages: 7
Registered: January 2017
Junior Member
Hello, thanks for your replays.

I will try to give and example of my problem.
In my meta-model I have a class with a transient attribute.

In the run-time environment or in my RCP I create a new project and I create an instance of this class as a root and I assign a value to the transient attribute. When I reload the run-time environment the value that I assigned is lost, obviously because it is a transient.

Currently, I have extended the AdapterImpl and I get a notification when the root instance is loaded and I assign a value to the transient attribute, so when I reload the run-time environment I have my desired value at the time that the run-time environment is open.

The problem with my current approach is that I when receive the notification the root instance does not know anything about the rest of the instances that I have because they are not loaded yet.

I have also other classes with transient attributes and some attributes depend on other classes. With my current approach I have to add more notifications and make sure that the other instances are loaded.

However, instead of adding more notifications I would like to ask if there is any way to check when all my instances are loaded and then assign my desired values. What other options do I have?

thanks in advance,
Kostas
Re: Check model instances when run-time environment is loading [message #1768506 is a reply to message #1768491] Wed, 19 July 2017 14:41 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29112
Registered: July 2009
Senior Member
The question remains, where is all this being loaded? Presumably all in some resource set, that you create? You can listen to a resource set loading resources. You can also use an EContentAdapter to add a single adapter a resource set, all resources it contains, and to all objects in those resources. It updates (attached itself) automatically. Perhaps something like that would help. In the end though, I imagine your loading something into a resource set and what to do that checks after that's been done.
Previous Topic:[CDO] Refresh cdoPermission
Next Topic:Loading model slowly
Goto Forum:
  


Current Time: Wed Jan 17 01:50:04 GMT 2018

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

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