Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Possible bug in generated DocumentProvider::saveDocumentToFile method?
Possible bug in generated DocumentProvider::saveDocumentToFile method? [message #6605] Fri, 04 August 2006 13:53 Go to next message
Eclipse UserFriend
Originally posted by: lynchjack.hotmail.com

Hi,

I'm seeing an issue where I

- create diagram A via New File wizard and close it
- create another diagram B via New File wizard
- attempt to open A again and get a NullPointerException because the content
of the diagram file has been overwritten (set to empyy) during the creation
of B.

Investigating, I find that the same TransactionalEditingDomain and
ResourceSet are in use for both diagrams.. In the generated
saveDocumentToFile method it saves the diagram file and then iterates
through all resources in the ResourcetSet, saving them if they're not the
diagram one. I guess this is the "save model(s)" part. It seems that A is
still there, with its diagramResource not loaded, but the modelResouce
loaded. Calling save on the non-loaded diagramResource is what is causing
the overwrite (a call to resource.isLoaded() is probably needed before
calling save).

My question is, should *all* the resources in the set be saved here? In
theory the diagram could be backed by multiple resources, so I can see why
that code is there. But what if some of the resources are being edited by
another edtor?

Perhaps my real problem is having the same EditingDomain and ResourceSet
being used by multiple editors?

Thanks,
Jack
Re: Possible bug in generated DocumentProvider::saveDocumentToFile method? [message #6623 is a reply to message #6605] Fri, 04 August 2006 14:15 Go to previous message
Eclipse UserFriend
Originally posted by: lynchjack.hotmail.com

Found what causes the problem, take the mindmap example and add an extension
of type
org.eclipse.emf.transaction.editingDomains

with values

org.eclipse.gmf.examples.mindmap.diagram.EditingDomain
org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFac tory

Then create A and close. Create B. Attempt to open A.

To be honest, I can't remember why I contributed the editing domain in the
first place :-(

Thanks,
Jack

"Jack Lynch" <lynchjack@hotmail.com> wrote in message
news:eavjid$viq$1@utils.eclipse.org...
> Hi,
>
> I'm seeing an issue where I
>
> - create diagram A via New File wizard and close it
> - create another diagram B via New File wizard
> - attempt to open A again and get a NullPointerException because the
> content of the diagram file has been overwritten (set to empyy) during the
> creation of B.
>
> Investigating, I find that the same TransactionalEditingDomain and
> ResourceSet are in use for both diagrams.. In the generated
> saveDocumentToFile method it saves the diagram file and then iterates
> through all resources in the ResourcetSet, saving them if they're not the
> diagram one. I guess this is the "save model(s)" part. It seems that A
> is still there, with its diagramResource not loaded, but the modelResouce
> loaded. Calling save on the non-loaded diagramResource is what is causing
> the overwrite (a call to resource.isLoaded() is probably needed before
> calling save).
>
> My question is, should *all* the resources in the set be saved here? In
> theory the diagram could be backed by multiple resources, so I can see why
> that code is there. But what if some of the resources are being edited
> by another edtor?
>
> Perhaps my real problem is having the same EditingDomain and ResourceSet
> being used by multiple editors?
>
> Thanks,
> Jack
>
>
Previous Topic:How to get the active tool from the palette?
Next Topic:New to GMF - help needed
Goto Forum:
  


Current Time: Sat Dec 21 14:48:31 GMT 2024

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

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

Back to the top