Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo + GMF] Diagram and model element handling
[Teneo + GMF] Diagram and model element handling [message #126055] Thu, 19 June 2008 09:20 Go to next message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hello Martin and Teneo users!

For my application I want to give the user the possibilty to create and
also undo/redo/copy/paste (summed up mostly all capabilities which
emf.edit provides out of the box) diagram instances.
My current solution works but I am not really satisfied (and you probably
too when you read this post :) ).

Every Diagram "container" model instance (in your tutorial the "Map")
relates to the GMF "Diagram" model instance. With this rule in mind I do
the following:
I tell you which step I perform when creating my "Map" + "Diagram"
instance:
I create and initialize the "Map" on the command stack. Then I save the
resource so that the ID attribute gets filled and has an unique value.
Then I create the "Diagram" instance on the command stack and set the name
to the id of the "Map". So now I have a very simple reference between the
"Map" and the "Diagram" that I need when opening the diagram editor. Then
I save the resource again.
When opening the diagram I use the following query: "query1=from
Map&query2=from Diagram where name='[Map Id that should be opened]'".

As you can see undo and redo is not really possible, also the same for
deleting, copy and paste, because the Map is not really referenced to the
Diagram.

The rest of my code is nearly exactly the same as used in the Tutorial.

So how would you do it when you want to open serveral different diagram
instances?!?

Thank you for your answers!
Matthias
Re: [Teneo + GMF] Diagram and model element handling [message #126068 is a reply to message #126055] Thu, 19 June 2008 13:24 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
Hmmm, I don't yet understand, why don't you create and save the diagram and map in one step (so
create both and then save the resource)?
To guess what you want to achieve in the end: do you want to create the map/diagram and then open
the editor without first saving them in the db? So then the save happens when someone selects save
in the diagram.

gr. Martin

Matthias wrote:
> Hello Martin and Teneo users!
>
> For my application I want to give the user the possibilty to create and
> also undo/redo/copy/paste (summed up mostly all capabilities which
> emf.edit provides out of the box) diagram instances.
> My current solution works but I am not really satisfied (and you
> probably too when you read this post :) ).
>
> Every Diagram "container" model instance (in your tutorial the "Map")
> relates to the GMF "Diagram" model instance. With this rule in mind I do
> the following:
> I tell you which step I perform when creating my "Map" + "Diagram"
> instance:
> I create and initialize the "Map" on the command stack. Then I save the
> resource so that the ID attribute gets filled and has an unique value.
> Then I create the "Diagram" instance on the command stack and set the
> name to the id of the "Map". So now I have a very simple reference
> between the "Map" and the "Diagram" that I need when opening the diagram
> editor. Then I save the resource again.
> When opening the diagram I use the following query: "query1=from
> Map&query2=from Diagram where name='[Map Id that should be opened]'".
>
> As you can see undo and redo is not really possible, also the same for
> deleting, copy and paste, because the Map is not really referenced to
> the Diagram.
> The rest of my code is nearly exactly the same as used in the Tutorial.
>
> So how would you do it when you want to open serveral different diagram
> instances?!?
>
> Thank you for your answers!
> Matthias
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo + GMF] Diagram and model element handling [message #126081 is a reply to message #126068] Thu, 19 June 2008 16:02 Go to previous messageGo to next message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hello Martin!

Thanks for your answer. Sorry ok I understand that my post is/was a bit
confusing... I am sorry for that.

You are absoluetely right, why not create the "Map" and the "Diagram"
within one command or step. Ok this works perfectly, till to the part that
opens the diagram editor.
In your tutorial you do the following: "page.openEditor(new
URIEditorInput(StoreController.DATABASE_URI), MindmapDiagramEditor.ID);"
where DATABASE_URI is "hbxml://?dsname=mindmap&query1=from Map&query2=from
Diagram".
But this works only when you have one Diagram-Map (for me). If you have
more map instances than the query selects (for me) the first Diagram-Map
and the editor shows always the same diagram map regardless which . So I
thought, putting a where clause to the query would help, but it does not.

Or do you have each diagram-map in its own resource?!? For me, I have one
resource in my application and I add each diagram-map to this (global)
resource.

Thanks,
Matthias
Re: [Teneo + GMF] Diagram and model element handling [message #126094 is a reply to message #126081] Thu, 19 June 2008 16:16 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
Okay, how will the user of your software open the editor? Will he/she for example start from a list
of map/diagram combinations and then open the editor? In that case you can take the map and diagram
id from the list and use both id's for the query for the resource which will then result in one
map/diagram combination in the query. Btw, the query you showed below will load more diagram/map
instances in the resource but probably gmf will only use the first one.

Another thing you can try is only query for the diagram object, afaiu the diagram references the
map. Then depending on the load strategy of the resource the map is loaded automatically in the
resource, see here:
http://www.elver.org/hibernate/hibernateresources.html#Load+ of+referenced+Objects

I hope this helps a bit (I don't know that much about GMF...).

gr. Martin

Matthias wrote:
> Hello Martin!
>
> Thanks for your answer. Sorry ok I understand that my post is/was a bit
> confusing... I am sorry for that.
> You are absoluetely right, why not create the "Map" and the "Diagram"
> within one command or step. Ok this works perfectly, till to the part
> that opens the diagram editor. In your tutorial you do the following:
> "page.openEditor(new URIEditorInput(StoreController.DATABASE_URI),
> MindmapDiagramEditor.ID);" where DATABASE_URI is
> "hbxml://?dsname=mindmap&query1=from Map&query2=from Diagram". But this
> works only when you have one Diagram-Map (for me). If you have more map
> instances than the query selects (for me) the first Diagram-Map and the
> editor shows always the same diagram map regardless which . So I
> thought, putting a where clause to the query would help, but it does not.
>
> Or do you have each diagram-map in its own resource?!? For me, I have
> one resource in my application and I add each diagram-map to this
> (global) resource.
>
> Thanks,
> Matthias
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo + GMF] Diagram and model element handling [message #126107 is a reply to message #126094] Fri, 20 June 2008 06:25 Go to previous messageGo to next message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hi Martin!

Thanks for your answer!

Requirement: The user selecets the Map instance from a list and on
double-click he opens the diagram editor.

Some try-and-error showed me, that it only works when putting a "where"
the Diagram related query part of the query ("&query3=from Diagram where
name = "). But what can/should I query?! The Diagram has no id attribut,
it only has a name attribute. So the only way (AFAIK) to open specific map
diagrams is to build up a reference between the Map and the Diagram that
can be accessed by the where clause in the query: So as described in my
first post I create the Map, save the Map in the resource to get an unique
id of the instance, then create the Diagram and set the name to that
unique Map id. With this approach I can query specific Map and Diagram
combinations ("&query3=from Diagram where name = '[Map-id]'").

Summed up for me it only worked opening specific map diagrams when putting
the where clause to the diagram query part, otherwise he only opens the
first map-diagram. When looking into the opening code of the GMF editor,
than he is only interested in the Diagram object and the search for the
reference "element" object.

So do we have any chance in the current implementation to overcome this
restrictions?!?

Thanks,
Matthias

Martin Taal wrote:

> Hi Matthias,
> Okay, how will the user of your software open the editor? Will he/she for
example start from a list
> of map/diagram combinations and then open the editor? In that case you can
take the map and diagram
> id from the list and use both id's for the query for the resource which will
then result in one
> map/diagram combination in the query. Btw, the query you showed below will
load more diagram/map
> instances in the resource but probably gmf will only use the first one.

> Another thing you can try is only query for the diagram object, afaiu the
diagram references the
> map. Then depending on the load strategy of the resource the map is loaded
automatically in the
> resource, see here:
>
http://www.elver.org/hibernate/hibernateresources.html#Load+ of+referenced+Objects

> I hope this helps a bit (I don't know that much about GMF...).

> gr. Martin
Re: [Teneo + GMF] Diagram and model element handling [message #126120 is a reply to message #126107] Fri, 20 June 2008 10:57 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
Just to be sure, what you would like to achieve is to be able to not-save the diagram before opening
the editor, is that correct?

gr. Martin

Matthias wrote:
> Hi Martin!
>
> Thanks for your answer!
>
> Requirement: The user selecets the Map instance from a list and on
> double-click he opens the diagram editor.
> Some try-and-error showed me, that it only works when putting a "where"
> the Diagram related query part of the query ("&query3=from Diagram where
> name = "). But what can/should I query?! The Diagram has no id attribut,
> it only has a name attribute. So the only way (AFAIK) to open specific
> map diagrams is to build up a reference between the Map and the Diagram
> that can be accessed by the where clause in the query: So as described
> in my first post I create the Map, save the Map in the resource to get
> an unique id of the instance, then create the Diagram and set the name
> to that unique Map id. With this approach I can query specific Map and
> Diagram combinations ("&query3=from Diagram where name = '[Map-id]'").
> Summed up for me it only worked opening specific map diagrams when
> putting the where clause to the diagram query part, otherwise he only
> opens the first map-diagram. When looking into the opening code of the
> GMF editor, than he is only interested in the Diagram object and the
> search for the reference "element" object.
>
> So do we have any chance in the current implementation to overcome this
> restrictions?!?
>
> Thanks,
> Matthias
>
> Martin Taal wrote:
>
>> Hi Matthias,
>> Okay, how will the user of your software open the editor? Will he/she for
> example start from a list
>> of map/diagram combinations and then open the editor? In that case you
>> can
> take the map and diagram
>> id from the list and use both id's for the query for the resource
>> which will
> then result in one
>> map/diagram combination in the query. Btw, the query you showed below
>> will
> load more diagram/map
>> instances in the resource but probably gmf will only use the first one.
>
>> Another thing you can try is only query for the diagram object, afaiu the
> diagram references the
>> map. Then depending on the load strategy of the resource the map is
>> loaded
> automatically in the
>> resource, see here:
>>
> http://www.elver.org/hibernate/hibernateresources.html#Load+ of+referenced+Objects
>
>
>> I hope this helps a bit (I don't know that much about GMF...).
>
>> gr. Martin
>
>
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo + GMF] Diagram and model element handling [message #126130 is a reply to message #126120] Fri, 20 June 2008 11:38 Go to previous messageGo to next message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hi Martin!

Yes correct. Is this possible?!

Best regards,
Matthias


Martin Taal wrote:

> Hi Matthias,
> Just to be sure, what you would like to achieve is to be able to not-save
the diagram before opening
> the editor, is that correct?

> gr. Martin
Re: [Teneo + GMF] Diagram and model element handling [message #126141 is a reply to message #126130] Fri, 20 June 2008 13:18 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
No direct answer but just an idea. You can try to find how the editor finds the resource. Probably
the editor uses a resource set from somewhere (the editingdomain). I am not sure if this possible
but if this resource set exists then before opening the editor you can add the resource to the
resourceset without saving the resource first. Or maybe implement your own editorinput type.
I am guessing here, but if you debug through the code then maybe you can find the correct hooks to
do this.
By setting breakpoints in the load resource and resource.getContents methods you can probably find
the location where the resource is actually loaded.

gr. Martin

Matthias wrote:
> Hi Martin!
>
> Yes correct. Is this possible?!
>
> Best regards,
> Matthias
>
>
> Martin Taal wrote:
>
>> Hi Matthias,
>> Just to be sure, what you would like to achieve is to be able to not-save
> the diagram before opening
>> the editor, is that correct?
>
>> gr. Martin
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo + GMF] Diagram and model element handling [message #126298 is a reply to message #126141] Wed, 25 June 2008 07:56 Go to previous messageGo to next message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hi Martin!

I tried to implement the ideas you suggested but with no luck. The main
problem is that the resource, used in the XXXDiagramEditor code (load()
method), does not find the Map object in the resource, it only finds the
diagram object. But this diagram returns always null when invoking
getElement(). This is not the case if I persist the Map and Diagram into
the resource, before the GMF diagram is opened. I also tried using both
load strategies...

I also tried to use a custom EditorInput that passes the Map and its
resource: I added the map's resource to the resourceSet in the code, then
it finds the Map object but later I get a nasty NullPointerException
(something about Commands problems) which seems to me, that the
TransactionalEditingDomain cannot handle this resource. But my Map object
must be contained in a resource that can be handeled by the
AdapterFactoryEditingDomain, otherwise my other domain model instances do
not "see" the Map.

I spent very much hours solving this problem, but with no success. Maybe
this question is also very GMF related. For me this problem is not only
related to opening diagrams without saving them before, but also to open a
map when you have more than one map instances in you application (as
already discussed in the previous posts).

If someone has code snippets/tutorials or whatever I would be very happy
to solve this issues and to get away from my current implementation!

Thanks,
Matthias
Re: [Teneo + GMF] Diagram and model element handling [message #126359 is a reply to message #126298] Wed, 25 June 2008 17:57 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
See comments inline.

gr. Martin

Matthias wrote:
> Hi Martin!
>
> I tried to implement the ideas you suggested but with no luck. The main
> problem is that the resource, used in the XXXDiagramEditor code (load()
> method), does not find the Map object in the resource, it only finds the
> diagram object. But this diagram returns always null when invoking
> getElement(). This is not the case if I persist the Map and Diagram into
> the resource, before the GMF diagram is opened. I also tried using both
> load strategies...
MT>> I think I lost track... some questions:
- which url did you use to open this resource? Or how did it get into the editor?
- How did you put the map in the diagram (what happens when you do diagram.setElement(..))?

>
> I also tried to use a custom EditorInput that passes the Map and its
> resource: I added the map's resource to the resourceSet in the code,
> then it finds the Map object but later I get a nasty
> NullPointerException (something about Commands problems) which seems to
> me, that the TransactionalEditingDomain cannot handle this resource. But
> my Map object must be contained in a resource that can be handeled by
> the AdapterFactoryEditingDomain, otherwise my other domain model
> instances do not "see" the Map.
> I spent very much hours solving this problem, but with no success. Maybe
> this question is also very GMF related. For me this problem is not only
> related to opening diagrams without saving them before, but also to open
> a map when you have more than one map instances in you application (as
> already discussed in the previous posts).
>
> If someone has code snippets/tutorials or whatever I would be very happy
> to solve this issues and to get away from my current implementation!
MT>> If you can zip it up then I can a look at it (will be early next week though).
>
> Thanks,
> Matthias
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo + GMF] Diagram and model element handling - SOLVED [message #127391 is a reply to message #126359] Thu, 24 July 2008 09:15 Go to previous messageGo to next message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hi!

Finally I have an acceptable solution (at least for me) that allows me to
open a Map + Diagram that have not been persisted to database yet and a
better handling of Maps and their Diagram when opening the Diagram Editor.

If you want code or further explanation how I have implemented that into
my project feel free to ask per mail (I am on gmail.com) or whatever.

Ohh and Martin thank you very much for your input and your offering to
have a look at my code!!!

Best regards,
Matthias
Re: [Teneo + GMF] Diagram and model element handling - SOLVED [message #127510 is a reply to message #127391] Thu, 24 July 2008 10:47 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
I am happy to hear that it works!
It would be really great if you can send me an email with a description of what you did. I don't use
GMF myself so therefore it is always difficult to have enough detailed information for me.

gr. Martin

Matthias wrote:
> Hi!
>
> Finally I have an acceptable solution (at least for me) that allows me
> to open a Map + Diagram that have not been persisted to database yet and
> a better handling of Maps and their Diagram when opening the Diagram
> Editor.
> If you want code or further explanation how I have implemented that into
> my project feel free to ask per mail (I am on gmail.com) or whatever.
>
> Ohh and Martin thank you very much for your input and your offering to
> have a look at my code!!!
>
> Best regards,
> Matthias
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo + GMF] Diagram and model element handling [message #619261 is a reply to message #126055] Thu, 19 June 2008 13:24 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
Hmmm, I don't yet understand, why don't you create and save the diagram and map in one step (so
create both and then save the resource)?
To guess what you want to achieve in the end: do you want to create the map/diagram and then open
the editor without first saving them in the db? So then the save happens when someone selects save
in the diagram.

gr. Martin

Matthias wrote:
> Hello Martin and Teneo users!
>
> For my application I want to give the user the possibilty to create and
> also undo/redo/copy/paste (summed up mostly all capabilities which
> emf.edit provides out of the box) diagram instances.
> My current solution works but I am not really satisfied (and you
> probably too when you read this post :) ).
>
> Every Diagram "container" model instance (in your tutorial the "Map")
> relates to the GMF "Diagram" model instance. With this rule in mind I do
> the following:
> I tell you which step I perform when creating my "Map" + "Diagram"
> instance:
> I create and initialize the "Map" on the command stack. Then I save the
> resource so that the ID attribute gets filled and has an unique value.
> Then I create the "Diagram" instance on the command stack and set the
> name to the id of the "Map". So now I have a very simple reference
> between the "Map" and the "Diagram" that I need when opening the diagram
> editor. Then I save the resource again.
> When opening the diagram I use the following query: "query1=from
> Map&query2=from Diagram where name='[Map Id that should be opened]'".
>
> As you can see undo and redo is not really possible, also the same for
> deleting, copy and paste, because the Map is not really referenced to
> the Diagram.
> The rest of my code is nearly exactly the same as used in the Tutorial.
>
> So how would you do it when you want to open serveral different diagram
> instances?!?
>
> Thank you for your answers!
> Matthias
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo + GMF] Diagram and model element handling [message #619262 is a reply to message #126068] Thu, 19 June 2008 16:02 Go to previous message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hello Martin!

Thanks for your answer. Sorry ok I understand that my post is/was a bit
confusing... I am sorry for that.

You are absoluetely right, why not create the "Map" and the "Diagram"
within one command or step. Ok this works perfectly, till to the part that
opens the diagram editor.
In your tutorial you do the following: "page.openEditor(new
URIEditorInput(StoreController.DATABASE_URI), MindmapDiagramEditor.ID);"
where DATABASE_URI is "hbxml://?dsname=mindmap&query1=from Map&query2=from
Diagram".
But this works only when you have one Diagram-Map (for me). If you have
more map instances than the query selects (for me) the first Diagram-Map
and the editor shows always the same diagram map regardless which . So I
thought, putting a where clause to the query would help, but it does not.

Or do you have each diagram-map in its own resource?!? For me, I have one
resource in my application and I add each diagram-map to this (global)
resource.

Thanks,
Matthias
Re: [Teneo + GMF] Diagram and model element handling [message #619263 is a reply to message #126081] Thu, 19 June 2008 16:16 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
Okay, how will the user of your software open the editor? Will he/she for example start from a list
of map/diagram combinations and then open the editor? In that case you can take the map and diagram
id from the list and use both id's for the query for the resource which will then result in one
map/diagram combination in the query. Btw, the query you showed below will load more diagram/map
instances in the resource but probably gmf will only use the first one.

Another thing you can try is only query for the diagram object, afaiu the diagram references the
map. Then depending on the load strategy of the resource the map is loaded automatically in the
resource, see here:
http://www.elver.org/hibernate/hibernateresources.html#Load+ of+referenced+Objects

I hope this helps a bit (I don't know that much about GMF...).

gr. Martin

Matthias wrote:
> Hello Martin!
>
> Thanks for your answer. Sorry ok I understand that my post is/was a bit
> confusing... I am sorry for that.
> You are absoluetely right, why not create the "Map" and the "Diagram"
> within one command or step. Ok this works perfectly, till to the part
> that opens the diagram editor. In your tutorial you do the following:
> "page.openEditor(new URIEditorInput(StoreController.DATABASE_URI),
> MindmapDiagramEditor.ID);" where DATABASE_URI is
> "hbxml://?dsname=mindmap&query1=from Map&query2=from Diagram". But this
> works only when you have one Diagram-Map (for me). If you have more map
> instances than the query selects (for me) the first Diagram-Map and the
> editor shows always the same diagram map regardless which . So I
> thought, putting a where clause to the query would help, but it does not.
>
> Or do you have each diagram-map in its own resource?!? For me, I have
> one resource in my application and I add each diagram-map to this
> (global) resource.
>
> Thanks,
> Matthias
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo + GMF] Diagram and model element handling [message #619264 is a reply to message #126094] Fri, 20 June 2008 06:25 Go to previous message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hi Martin!

Thanks for your answer!

Requirement: The user selecets the Map instance from a list and on
double-click he opens the diagram editor.

Some try-and-error showed me, that it only works when putting a "where"
the Diagram related query part of the query ("&query3=from Diagram where
name = "). But what can/should I query?! The Diagram has no id attribut,
it only has a name attribute. So the only way (AFAIK) to open specific map
diagrams is to build up a reference between the Map and the Diagram that
can be accessed by the where clause in the query: So as described in my
first post I create the Map, save the Map in the resource to get an unique
id of the instance, then create the Diagram and set the name to that
unique Map id. With this approach I can query specific Map and Diagram
combinations ("&query3=from Diagram where name = '[Map-id]'").

Summed up for me it only worked opening specific map diagrams when putting
the where clause to the diagram query part, otherwise he only opens the
first map-diagram. When looking into the opening code of the GMF editor,
than he is only interested in the Diagram object and the search for the
reference "element" object.

So do we have any chance in the current implementation to overcome this
restrictions?!?

Thanks,
Matthias

Martin Taal wrote:

> Hi Matthias,
> Okay, how will the user of your software open the editor? Will he/she for
example start from a list
> of map/diagram combinations and then open the editor? In that case you can
take the map and diagram
> id from the list and use both id's for the query for the resource which will
then result in one
> map/diagram combination in the query. Btw, the query you showed below will
load more diagram/map
> instances in the resource but probably gmf will only use the first one.

> Another thing you can try is only query for the diagram object, afaiu the
diagram references the
> map. Then depending on the load strategy of the resource the map is loaded
automatically in the
> resource, see here:
>
http://www.elver.org/hibernate/hibernateresources.html#Load+ of+referenced+Objects

> I hope this helps a bit (I don't know that much about GMF...).

> gr. Martin
Re: [Teneo + GMF] Diagram and model element handling [message #619265 is a reply to message #126107] Fri, 20 June 2008 10:57 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
Just to be sure, what you would like to achieve is to be able to not-save the diagram before opening
the editor, is that correct?

gr. Martin

Matthias wrote:
> Hi Martin!
>
> Thanks for your answer!
>
> Requirement: The user selecets the Map instance from a list and on
> double-click he opens the diagram editor.
> Some try-and-error showed me, that it only works when putting a "where"
> the Diagram related query part of the query ("&query3=from Diagram where
> name = "). But what can/should I query?! The Diagram has no id attribut,
> it only has a name attribute. So the only way (AFAIK) to open specific
> map diagrams is to build up a reference between the Map and the Diagram
> that can be accessed by the where clause in the query: So as described
> in my first post I create the Map, save the Map in the resource to get
> an unique id of the instance, then create the Diagram and set the name
> to that unique Map id. With this approach I can query specific Map and
> Diagram combinations ("&query3=from Diagram where name = '[Map-id]'").
> Summed up for me it only worked opening specific map diagrams when
> putting the where clause to the diagram query part, otherwise he only
> opens the first map-diagram. When looking into the opening code of the
> GMF editor, than he is only interested in the Diagram object and the
> search for the reference "element" object.
>
> So do we have any chance in the current implementation to overcome this
> restrictions?!?
>
> Thanks,
> Matthias
>
> Martin Taal wrote:
>
>> Hi Matthias,
>> Okay, how will the user of your software open the editor? Will he/she for
> example start from a list
>> of map/diagram combinations and then open the editor? In that case you
>> can
> take the map and diagram
>> id from the list and use both id's for the query for the resource
>> which will
> then result in one
>> map/diagram combination in the query. Btw, the query you showed below
>> will
> load more diagram/map
>> instances in the resource but probably gmf will only use the first one.
>
>> Another thing you can try is only query for the diagram object, afaiu the
> diagram references the
>> map. Then depending on the load strategy of the resource the map is
>> loaded
> automatically in the
>> resource, see here:
>>
> http://www.elver.org/hibernate/hibernateresources.html#Load+ of+referenced+Objects
>
>
>> I hope this helps a bit (I don't know that much about GMF...).
>
>> gr. Martin
>
>
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo + GMF] Diagram and model element handling [message #619266 is a reply to message #126120] Fri, 20 June 2008 11:38 Go to previous message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hi Martin!

Yes correct. Is this possible?!

Best regards,
Matthias


Martin Taal wrote:

> Hi Matthias,
> Just to be sure, what you would like to achieve is to be able to not-save
the diagram before opening
> the editor, is that correct?

> gr. Martin
Re: [Teneo + GMF] Diagram and model element handling [message #619267 is a reply to message #126130] Fri, 20 June 2008 13:18 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
No direct answer but just an idea. You can try to find how the editor finds the resource. Probably
the editor uses a resource set from somewhere (the editingdomain). I am not sure if this possible
but if this resource set exists then before opening the editor you can add the resource to the
resourceset without saving the resource first. Or maybe implement your own editorinput type.
I am guessing here, but if you debug through the code then maybe you can find the correct hooks to
do this.
By setting breakpoints in the load resource and resource.getContents methods you can probably find
the location where the resource is actually loaded.

gr. Martin

Matthias wrote:
> Hi Martin!
>
> Yes correct. Is this possible?!
>
> Best regards,
> Matthias
>
>
> Martin Taal wrote:
>
>> Hi Matthias,
>> Just to be sure, what you would like to achieve is to be able to not-save
> the diagram before opening
>> the editor, is that correct?
>
>> gr. Martin
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo + GMF] Diagram and model element handling [message #619311 is a reply to message #126141] Wed, 25 June 2008 07:56 Go to previous message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hi Martin!

I tried to implement the ideas you suggested but with no luck. The main
problem is that the resource, used in the XXXDiagramEditor code (load()
method), does not find the Map object in the resource, it only finds the
diagram object. But this diagram returns always null when invoking
getElement(). This is not the case if I persist the Map and Diagram into
the resource, before the GMF diagram is opened. I also tried using both
load strategies...

I also tried to use a custom EditorInput that passes the Map and its
resource: I added the map's resource to the resourceSet in the code, then
it finds the Map object but later I get a nasty NullPointerException
(something about Commands problems) which seems to me, that the
TransactionalEditingDomain cannot handle this resource. But my Map object
must be contained in a resource that can be handeled by the
AdapterFactoryEditingDomain, otherwise my other domain model instances do
not "see" the Map.

I spent very much hours solving this problem, but with no success. Maybe
this question is also very GMF related. For me this problem is not only
related to opening diagrams without saving them before, but also to open a
map when you have more than one map instances in you application (as
already discussed in the previous posts).

If someone has code snippets/tutorials or whatever I would be very happy
to solve this issues and to get away from my current implementation!

Thanks,
Matthias
Re: [Teneo + GMF] Diagram and model element handling [message #619324 is a reply to message #126298] Wed, 25 June 2008 17:57 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
See comments inline.

gr. Martin

Matthias wrote:
> Hi Martin!
>
> I tried to implement the ideas you suggested but with no luck. The main
> problem is that the resource, used in the XXXDiagramEditor code (load()
> method), does not find the Map object in the resource, it only finds the
> diagram object. But this diagram returns always null when invoking
> getElement(). This is not the case if I persist the Map and Diagram into
> the resource, before the GMF diagram is opened. I also tried using both
> load strategies...
MT>> I think I lost track... some questions:
- which url did you use to open this resource? Or how did it get into the editor?
- How did you put the map in the diagram (what happens when you do diagram.setElement(..))?

>
> I also tried to use a custom EditorInput that passes the Map and its
> resource: I added the map's resource to the resourceSet in the code,
> then it finds the Map object but later I get a nasty
> NullPointerException (something about Commands problems) which seems to
> me, that the TransactionalEditingDomain cannot handle this resource. But
> my Map object must be contained in a resource that can be handeled by
> the AdapterFactoryEditingDomain, otherwise my other domain model
> instances do not "see" the Map.
> I spent very much hours solving this problem, but with no success. Maybe
> this question is also very GMF related. For me this problem is not only
> related to opening diagrams without saving them before, but also to open
> a map when you have more than one map instances in you application (as
> already discussed in the previous posts).
>
> If someone has code snippets/tutorials or whatever I would be very happy
> to solve this issues and to get away from my current implementation!
MT>> If you can zip it up then I can a look at it (will be early next week though).
>
> Thanks,
> Matthias
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo + GMF] Diagram and model element handling - SOLVED [message #620139 is a reply to message #126359] Thu, 24 July 2008 09:15 Go to previous message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hi!

Finally I have an acceptable solution (at least for me) that allows me to
open a Map + Diagram that have not been persisted to database yet and a
better handling of Maps and their Diagram when opening the Diagram Editor.

If you want code or further explanation how I have implemented that into
my project feel free to ask per mail (I am on gmail.com) or whatever.

Ohh and Martin thank you very much for your input and your offering to
have a look at my code!!!

Best regards,
Matthias
Re: [Teneo + GMF] Diagram and model element handling - SOLVED [message #620145 is a reply to message #127391] Thu, 24 July 2008 10:47 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
I am happy to hear that it works!
It would be really great if you can send me an email with a description of what you did. I don't use
GMF myself so therefore it is always difficult to have enough detailed information for me.

gr. Martin

Matthias wrote:
> Hi!
>
> Finally I have an acceptable solution (at least for me) that allows me
> to open a Map + Diagram that have not been persisted to database yet and
> a better handling of Maps and their Diagram when opening the Diagram
> Editor.
> If you want code or further explanation how I have implemented that into
> my project feel free to ask per mail (I am on gmail.com) or whatever.
>
> Ohh and Martin thank you very much for your input and your offering to
> have a look at my code!!!
>
> Best regards,
> Matthias
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:CGLib proxy issue in Teneo 1.0 for One-To-One relationship
Next Topic:[EMF Compare] How to deactivate
Goto Forum:
  


Current Time: Sat Mar 28 15:42:44 GMT 2020

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

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

Back to the top