Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF multi page editor input and resource synchronize question?
EMF multi page editor input and resource synchronize question? [message #427858] Tue, 03 March 2009 02:02 Go to next message
Allen Wang is currently offline Allen WangFriend
Messages: 28
Registered: July 2009
Junior Member
Hi,

I managed to build a multi-page editor following GMF TopicMap example.
Now I need to use self-defined model (not GMFResource) as my EMF
generated editor input, how can I achieve this?

Let me explain this by code, in TopicMap example, we use
editingDomain.getResourceSet() as the EMF editor's input:

selectionEditorPart.setInput(editingDomain.getResourceSet()) ;

And now, I want to use TopicMap class as the input of the EMF editor in
order to let TopicMap as the root element of each editor viewer:

TopicMap topicMap =
(TopicMap)editingDomain.getResourceSet().getResources().get( 0).getContents().get(0);
selectionEditorPart.setInput(topicMap);

So I did this. At the beginning, this worked fine. But after you saved
the resource, you could not do any modifications in EMF editor or any
modifications can not be recorded. I guess that the resource is updated
after save and is not synchronized with the input of each EMF editor,
but I on't know the best practice how to resolve this problem.

Any suggestions? Thanks!


--
Hexise
Re: EMF multi page editor input and resource synchronize question? [message #427877 is a reply to message #427858] Tue, 03 March 2009 12:21 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Comments below.

hexise wrote:
> Hi,
>
> I managed to build a multi-page editor following GMF TopicMap example.
> Now I need to use self-defined model (not GMFResource) as my EMF
> generated editor input, how can I achieve this?
>
Just do it. :-P
> Let me explain this by code, in TopicMap example, we use
> editingDomain.getResourceSet() as the EMF editor's input:
>
> selectionEditorPart.setInput(editingDomain.getResourceSet()) ;
>
> And now, I want to use TopicMap class as the input of the EMF editor in
> order to let TopicMap as the root element of each editor viewer:
>
> TopicMap topicMap =
> (TopicMap)editingDomain.getResourceSet().getResources().get( 0).getContents().get(0);
> selectionEditorPart.setInput(topicMap);
>
That seems good.
> So I did this. At the beginning, this worked fine. But after you saved
> the resource, you could not do any modifications in EMF editor or any
> modifications can not be recorded.
It sounds like perhaps the save is causing your resource's objects to be
turned into proxies. That shouldn't be the case except if some other
editor change the underlying resource external to the editor.
> I guess that the resource is updated
> after save and is not synchronized with the input of each EMF editor,
>
I guess so, but in the generated EMF editor, that shouldn't happen. The
resource delta processing knows which resources were saved and ignores
those expected deltas.
> but I on't know the best practice how to resolve this problem.
>
You could listen for changes to the contents of the resource and call
setInput again with the new contents. But it sounds to me like you have
some bogus resource delta processing happening...
> Any suggestions? Thanks!
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Serialization of references
Next Topic:CDO as an enterprise persistence solution???
Goto Forum:
  


Current Time: Fri Apr 26 15:05:30 GMT 2024

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

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

Back to the top