Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » MultipageEditor and Databinding
MultipageEditor and Databinding [message #418983] Tue, 06 May 2008 20:33 Go to next message
Michael Haeberlen is currently offline Michael HaeberlenFriend
Messages: 52
Registered: July 2009
Member
Hi,

I have customized the generated emf editor and added some form based
master-details pages. To synchronize, I use EMF databinding (and I am
quite happy with it).
Now I have the following problem:
In some pages I have tree viewers which have input of the form
" editingDomain.getResourceSet().getResources().get(0).getCont ents().get(0) ".
Then I do some changes and make the editor dirty. When I click on
"save", somehow(?) the content reference of the resource changes and my
viewer input gets kind of stale. I didn't find a good solution yet, I
tried to add a commandstack listener but it didn't get notified about
the "save" operation.
Does anybody have an idea?

Thanks,
Michael
Re: MultipageEditor and Databinding [message #418984 is a reply to message #418983] Tue, 06 May 2008 21:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Michael,

I don't expect saving to change the contents of the resource (although
in the XML with a DocumentRoot case, the prefixes in the
getXMLNSPrefixMap are updated to reflect the prefixes used in the
serialization. But you can listen to the resource itself. It is a
Notifier just like an EObject is a Notifier, so you can listen for when
the contents change...


Michael Haeberlen wrote:
> Hi,
>
> I have customized the generated emf editor and added some form based
> master-details pages. To synchronize, I use EMF databinding (and I am
> quite happy with it).
> Now I have the following problem:
> In some pages I have tree viewers which have input of the form
> " editingDomain.getResourceSet().getResources().get(0).getCont ents().get(0) ".
> Then I do some changes and make the editor dirty. When I click on
> "save", somehow(?) the content reference of the resource changes and
> my viewer input gets kind of stale. I didn't find a good solution yet,
> I tried to add a commandstack listener but it didn't get notified
> about the "save" operation.
> Does anybody have an idea?
>
> Thanks,
> Michael


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: MultipageEditor and Databinding [message #418985 is a reply to message #418984] Wed, 07 May 2008 10:36 Go to previous messageGo to next message
Michael Haeberlen is currently offline Michael HaeberlenFriend
Messages: 52
Registered: July 2009
Member
Ed,

I made some progress in my investigations thanks to your hints. I
awkwardly forgot to mention that I also included two GMF diagrams in my
multipage editor. Those have a generated DiagramDocumentProvider with an
inner WorkspaceSynchronizer class which called a resource.unload().

I have to figure out how I need to customize the DiagramDocumentProvider.

Thanks again for responding!

Ed Merks wrote:
> Michael,
>
> I don't expect saving to change the contents of the resource (although
> in the XML with a DocumentRoot case, the prefixes in the
> getXMLNSPrefixMap are updated to reflect the prefixes used in the
> serialization. But you can listen to the resource itself. It is a
> Notifier just like an EObject is a Notifier, so you can listen for when
> the contents change...
>
>
> Michael Haeberlen wrote:
>> Hi,
>>
>> I have customized the generated emf editor and added some form based
>> master-details pages. To synchronize, I use EMF databinding (and I am
>> quite happy with it).
>> Now I have the following problem:
>> In some pages I have tree viewers which have input of the form
>> " editingDomain.getResourceSet().getResources().get(0).getCont ents().get(0) ".
>> Then I do some changes and make the editor dirty. When I click on
>> "save", somehow(?) the content reference of the resource changes and
>> my viewer input gets kind of stale. I didn't find a good solution yet,
>> I tried to add a commandstack listener but it didn't get notified
>> about the "save" operation.
>> Does anybody have an idea?
>>
>> Thanks,
>> Michael
Re: MultipageEditor and Databinding [message #418986 is a reply to message #418985] Wed, 07 May 2008 10:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Michael,

It sounds like the code might be taking an inappropriate action as a
result of a resource delta. In the generated EMF editor you'll see that
as the resource deltas are processed, it's important to know which
deltas are expected as a result of resources the editor itself has just
saved, i.e, savedResources is populated to influence a subsequent delta
processing is handled...


Michael Haeberlen wrote:
> Ed,
>
> I made some progress in my investigations thanks to your hints. I
> awkwardly forgot to mention that I also included two GMF diagrams in
> my multipage editor. Those have a generated DiagramDocumentProvider
> with an inner WorkspaceSynchronizer class which called a
> resource.unload().
>
> I have to figure out how I need to customize the DiagramDocumentProvider.
>
> Thanks again for responding!
>
> Ed Merks wrote:
>> Michael,
>>
>> I don't expect saving to change the contents of the resource
>> (although in the XML with a DocumentRoot case, the prefixes in the
>> getXMLNSPrefixMap are updated to reflect the prefixes used in the
>> serialization. But you can listen to the resource itself. It is a
>> Notifier just like an EObject is a Notifier, so you can listen for
>> when the contents change...
>>
>>
>> Michael Haeberlen wrote:
>>> Hi,
>>>
>>> I have customized the generated emf editor and added some form based
>>> master-details pages. To synchronize, I use EMF databinding (and I
>>> am quite happy with it).
>>> Now I have the following problem:
>>> In some pages I have tree viewers which have input of the form
>>> " editingDomain.getResourceSet().getResources().get(0).getCont ents().get(0) ".
>>> Then I do some changes and make the editor dirty. When I click on
>>> "save", somehow(?) the content reference of the resource changes and
>>> my viewer input gets kind of stale. I didn't find a good solution
>>> yet, I tried to add a commandstack listener but it didn't get
>>> notified about the "save" operation.
>>> Does anybody have an idea?
>>>
>>> Thanks,
>>> Michael


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: MultipageEditor and Databinding [message #418988 is a reply to message #418986] Wed, 07 May 2008 12:41 Go to previous message
Michael Haeberlen is currently offline Michael HaeberlenFriend
Messages: 52
Registered: July 2009
Member
Ed,

yes, the problem really is how I integrated the GMF generated diagrams.
I followed the eclipse corner article (about integrating EMF and GMF
editors) which has the same kind of problem. The GMF generated part
needs some more modification, obviously.

Ed Merks wrote:
> Michael,
>
> It sounds like the code might be taking an inappropriate action as a
> result of a resource delta. In the generated EMF editor you'll see that
> as the resource deltas are processed, it's important to know which
> deltas are expected as a result of resources the editor itself has just
> saved, i.e, savedResources is populated to influence a subsequent delta
> processing is handled...
>
>
> Michael Haeberlen wrote:
>> Ed,
>>
>> I made some progress in my investigations thanks to your hints. I
>> awkwardly forgot to mention that I also included two GMF diagrams in
>> my multipage editor. Those have a generated DiagramDocumentProvider
>> with an inner WorkspaceSynchronizer class which called a
>> resource.unload().
>>
>> I have to figure out how I need to customize the DiagramDocumentProvider.
>>
>> Thanks again for responding!
>>
>> Ed Merks wrote:
>>> Michael,
>>>
>>> I don't expect saving to change the contents of the resource
>>> (although in the XML with a DocumentRoot case, the prefixes in the
>>> getXMLNSPrefixMap are updated to reflect the prefixes used in the
>>> serialization. But you can listen to the resource itself. It is a
>>> Notifier just like an EObject is a Notifier, so you can listen for
>>> when the contents change...
>>>
>>>
>>> Michael Haeberlen wrote:
>>>> Hi,
>>>>
>>>> I have customized the generated emf editor and added some form based
>>>> master-details pages. To synchronize, I use EMF databinding (and I
>>>> am quite happy with it).
>>>> Now I have the following problem:
>>>> In some pages I have tree viewers which have input of the form
>>>> " editingDomain.getResourceSet().getResources().get(0).getCont ents().get(0) ".
>>>> Then I do some changes and make the editor dirty. When I click on
>>>> "save", somehow(?) the content reference of the resource changes and
>>>> my viewer input gets kind of stale. I didn't find a good solution
>>>> yet, I tried to add a commandstack listener but it didn't get
>>>> notified about the "save" operation.
>>>> Does anybody have an idea?
>>>>
>>>> Thanks,
>>>> Michael
Previous Topic:How to hide attribute in property view
Next Topic:Synchronization problems between model resources
Goto Forum:
  


Current Time: Sat Apr 20 04:07:22 GMT 2024

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

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

Back to the top