Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF + Teneo] EMF.edit actions and GMF
[EMF + Teneo] EMF.edit actions and GMF [message #420987] Sat, 19 July 2008 14:22 Go to next message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hi Ed and Martin!

I edit my model instances with the help of the provided EMF.edit actions
like CopyAction, CutAction, DeleteAction and so on. This works perfect
until I want to edit my "Map" model instance that can be displayed by the
GMF editor. As you know a map always must come with an diagram model
instance where the graphical information is persisted.
The problem is that the provided Action implementaiton does not work as
expected: DeleteAction only removes the map instance not the diagram
instance, CopyAction only copies the map instance and not the diagram too
and so on. AFAIK this is because the map does not know (say it has no
reference) anything about its diagram instance, only the diagram has a
non-containment reference to the map (Diagram.setElement() ).
So all these actions are useless for this type of model instances and I
have to provide additional implementation to this actions.

My ideas/questions are
a) how should I extend the provided actions so that also concern the
diagram instance?!? Iterate over all diagrams in the resource and search
for the adequate map?
b) do we have any API like "is referenced by"?!?
c) can this problem be easily solved with some proper resource handling:
like each map and diagram instance is stored inside its own resource, and
than the resource should be deleted, copied, etc.?! Is this possible with
the EMF edit actions out of the box?!
d) or maybe bad idea: keep a diagram reference in the map

Thanks for any ideas,
Matthias

PS: Do not forget I am using Teneo's Store Resource to persist and load my
model instances.
Re: [EMF + Teneo] EMF.edit actions and GMF [message #420988 is a reply to message #420987] Sat, 19 July 2008 16:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Matthias,

Comments below.

Matthias wrote:
> Hi Ed and Martin!
>
> I edit my model instances with the help of the provided EMF.edit
> actions like CopyAction, CutAction, DeleteAction and so on. This works
> perfect until I want to edit my "Map" model instance that can be
> displayed by the GMF editor. As you know a map always must come with
> an diagram model instance where the graphical information is persisted.
No, I don't really get it. I don't know all that much about GMF,
unfortunately.
> The problem is that the provided Action implementaiton does not work
> as expected: DeleteAction only removes the map instance not the
> diagram instance, CopyAction only copies the map instance and not the
> diagram too and so on.
It sounds like you should be doing something more directly with GMF and
acting on the diagram.
> AFAIK this is because the map does not know (say it has no reference)
> anything about its diagram instance, only the diagram has a
> non-containment reference to the map (Diagram.setElement() ). So all
> these actions are useless for this type of model instances and I have
> to provide additional implementation to this actions.
Yes, you'd need to act on both the model and the diagram that references it.
>
> My ideas/questions are
> a) how should I extend the provided actions so that also concern the
> diagram instance?!? Iterate over all diagrams in the resource and
> search for the adequate map?
There must be a GMF API for finding the diagram things that reference a
given model instance.
> b) do we have any API like "is referenced by"?!?
We have cross referencers and and an ECrossReferenceAdapter that
maintains up-to-date information about inverses of unidirectional
references.
> c) can this problem be easily solved with some proper resource
> handling: like each map and diagram instance is stored inside its own
> resource, and than the resource should be deleted, copied, etc.?! Is
> this possible with the EMF edit actions out of the box?!
I kind of doubt it. I just imagine that GMF must have a way to dealing
with all these basic issues though I think they don't reuse the commands
produced by the item providers (and I'm not sure why).
> d) or maybe bad idea: keep a diagram reference in the map
I'm slightly confused by this. The model is referring back to the
diagram for the model?
>
> Thanks for any ideas,
> Matthias
>
> PS: Do not forget I am using Teneo's Store Resource to persist and
> load my model instances.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMF + Teneo] EMF.edit actions and GMF [message #420992 is a reply to message #420988] Sun, 20 July 2008 08:17 Go to previous message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hi Ed!

Hmm I don't think that GMF provides an API for handling diagram and domain
resources, because normally this two resources are workspace resources
(files that are in your workspace) and not resources that are persisted in
a database.

I have decided to choose the simplest way: I have a containment reference
in my Map to a Diagram. So with this behaviour all default implementations
of the EMF.Edit Actions work out of the box.

Ok, I know it's not the cleanest way to have a reference in my domain
model to a model that's only purpose is to store graphical information,
but I think in this case my decision is quite defensible.

Thanks,
Matthias
Previous Topic:[Announce] Bon Voyage
Next Topic:subclass override field
Goto Forum:
  


Current Time: Thu Apr 25 10:11:44 GMT 2024

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

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

Back to the top