|
|
Re: How to not to persist the notational views [message #120370 is a reply to message #120307] |
Wed, 18 April 2007 21:48 |
Dhiraj 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
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03398 seconds