Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to not to persist the notational views
How to not to persist the notational views [message #120038] Tue, 17 April 2007 22:36 Go to next message
Dhiraj  is currently offline Dhiraj Friend
Messages: 18
Registered: July 2009
Junior Member
Hi,

My usecase is like this:-
I have a semantic Ecore model. I want to create a Graphical Editor for it
using
GMF. In that editor I need to show some Nodes (notational views) which
refer
to EObjects which are not in the semantic model, but are inferred from
those
existing in the semantic model.
So effectively my diagram will be having some views which need to be
persisted
and others which shouldn't be persisted, and should be created everytime I
open the diagram.

Can somebody suggest me the approach that will help me in achieving this?

Thanks,
Dhiraj
Re: How to not to persist the notational views [message #120307 is a reply to message #120038] Wed, 18 April 2007 16:12 Go to previous messageGo to next message
Mohammed Mostafa is currently offline Mohammed MostafaFriend
Messages: 143
Registered: July 2009
Senior Member
Hi ;

Here is the answer from the GMF runtime point of view

take a look at the ViewService.createNode method you will find that one
of the parameter is a boolean flag called persisted

if this flag is true then the view that will be created will not be
persisted in the diagram, but you have to keep in mind that as soon as
you change a property on this view it will be persisted also if a
persisted child had been added to the parent it will be persisted as well

The canonical edit policies create Transient views by default, you can
take a look there for an example



Dhiraj wrote:
> Hi,
>
> My usecase is like this:-
> I have a semantic Ecore model. I want to create a Graphical Editor for
> it using
> GMF. In that editor I need to show some Nodes (notational views) which
> refer
> to EObjects which are not in the semantic model, but are inferred from
> those
> existing in the semantic model.
> So effectively my diagram will be having some views which need to be
> persisted
> and others which shouldn't be persisted, and should be created everytime I
> open the diagram.
>
> Can somebody suggest me the approach that will help me in achieving this?
>
> Thanks,
> Dhiraj
>
Re: How to not to persist the notational views [message #120370 is a reply to message #120307] Wed, 18 April 2007 21:48 Go to previous message
Dhiraj  is currently offline Dhiraj Friend
Messages: 18
Registered: July 2009
Junior Member
Hi Mohammed,

Thanks for the reply.
But I have tried that approach and the problem is
exactly the thing that you mentioned. I am always creating the edges as
transient, and these edges are linking to Transient Nodes, because of
which all these transient nodes are getting persisted. I debugged the
runtime code and found that everytime a transaction is committed, all the
edges of the Diagram (irrespective of whether they are Transient or not)
are persisted (in the method DiagramEventBroker#transactionAboutToCommit()
the method PersistViewsCommand is being executed).
The reason I am trying not to persist these views is because the elements
(the semantic model objects) for these Views do not belong to any EMF
resource,
and hence when GMF (rather EMF) tries to persist these Views, the view
elements
are being persisted with wrong URIs. Because of this when the editor is
opened
next time, it fails to load the EObjects for these wrong URIs.

Can you think of any alternative mechanism of achieving this, if it is
not possible to avoid persisting all the Views?

Thanks,
Dhiraj


Mohammed Mostafa wrote:

> Hi ;

> Here is the answer from the GMF runtime point of view

> take a look at the ViewService.createNode method you will find that one
> of the parameter is a boolean flag called persisted

> if this flag is true then the view that will be created will not be
> persisted in the diagram, but you have to keep in mind that as soon as
> you change a property on this view it will be persisted also if a
> persisted child had been added to the parent it will be persisted as well

> The canonical edit policies create Transient views by default, you can
> take a look there for an example



> Dhiraj wrote:
>> Hi,
>>
>> My usecase is like this:-
>> I have a semantic Ecore model. I want to create a Graphical Editor for
>> it using
>> GMF. In that editor I need to show some Nodes (notational views) which
>> refer
>> to EObjects which are not in the semantic model, but are inferred from
>> those
>> existing in the semantic model.
>> So effectively my diagram will be having some views which need to be
>> persisted
>> and others which shouldn't be persisted, and should be created everytime I
>> open the diagram.
>>
>> Can somebody suggest me the approach that will help me in achieving this?
>>
>> Thanks,
>> Dhiraj
>>
Previous Topic:Does EMF/GMF support this?
Next Topic:How to make DefaultSizeNodeFigure transparent if two figure overlapped
Goto Forum:
  


Current Time: Fri Dec 27 09:34:36 GMT 2024

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

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

Back to the top