Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Duplicate resources
Duplicate resources [message #106296] Thu, 22 February 2007 08:58 Go to next message
Eclipse UserFriend
Originally posted by: james.willans.xactium.com

We are programmatically creating GMF diagrams for EMF elements, to do this
we have pulled out code from the generate wizard xNewDiagramFileWizard.
This works fine. The problem we are having is when a diagram is deleted
and then recreated. When the diagram's file is deleted the diagram
resource is unloaded from a (shared) resource set and just the diagram
root element remains in the resource set (I think this is expected
behaviour). If a diagram is subsequently recreated with the same
filename, then a new diagram resource is added to the resource set
alongside the previous one. This does not happen when the diagrams are
created using the wizard. My question is - who is responsible for
checking whether a resource exists in a resource set and precisely what
criteria is used to evaluate this (please point me to the code for this).

Thanks,

James
Re: Duplicate resources [message #106310 is a reply to message #106296] Thu, 22 February 2007 10:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: thomas.forster.iese.fhg.de

James Willans schrieb:
> We are programmatically creating GMF diagrams for EMF elements, to do
> this we have pulled out code from the generate wizard
> xNewDiagramFileWizard. This works fine. The problem we are having is
> when a diagram is deleted and then recreated. When the diagram's file
> is deleted the diagram resource is unloaded from a (shared) resource set
> and just the diagram root element remains in the resource set (I think
> this is expected behaviour). If a diagram is subsequently recreated
> with the same filename, then a new diagram resource is added to the
> resource set alongside the previous one. This does not happen when the
> diagrams are created using the wizard. My question is - who is
> responsible for checking whether a resource exists in a resource set and
> precisely what criteria is used to evaluate this (please point me to the
> code for this).
>
> Thanks,
>
> James
>
Actually I came across the same problem when opening separate diagrams
on Model Elements.
What works for me is to listen to workspace change events and whenever a
digram File is deleted the corresponding resource is removed from the
shared ResourceSet.
(It should also work the other way round, deleting an elemnt should
remove the Diagram File and the Diagram Resource to avoid inconsistencies)

Regards Thomas
Re: Duplicate resources [message #106324 is a reply to message #106310] Thu, 22 February 2007 11:38 Go to previous message
Eclipse UserFriend
Originally posted by: james.willans.xactium.com

Just to clarify I think the resource is being removed from the resourceSet
via Resource.unload, a stub remains in the resource set which according to
the documentation for unload, is expected behaviour. The problem is when
a new diagram is opened with the same name. When I do this via my code a
new resource is placed in the resource set alongside the legacy one. When
this is done via the generated wizard code, the original is reused.

James
Previous Topic:Color of Connection does not work in GMF 2.0
Next Topic:CompoundCommand with EMF DeleteCommand and GMF getDestroyElementCommand
Goto Forum:
  


Current Time: Wed Jul 16 08:18:28 EDT 2025

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

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

Back to the top