Access EcoreModel instance [message #416420] |
Thu, 31 January 2008 09:17 |
Eclipse User |
|
|
|
Originally posted by: harkon.ogame.gmail.com
Hi everybody...
I encountered a problem in accessing an instance of a Ecore modell
residing in my workspace of Eclipse.
Situation: I want to access an Ecore Modell from a newly created Plugin
existing in the current Eclipse instance. This can be done via an URL file
based. if I now open die URL I can access the content and everything is
fine.
Now if an Ecore Model editor is open in the same time the model won't be
updated immediately. I have to refresh the display.
Question: The Ecore Model Editor owns a Ecore Model reference itself
(EObject root node). How can I access this root node of the opened Ecore
Model Editor?
The background is: I want to alter the content of an Ecore model via EMF
techniques and whenever a change was registered the EMF fires various
events about this update and the Ecore Model Editor changes its display
"on the fly". Now if I change the model from another Eclipse Plugin via
this root node instance of the opened Ecore Model Editor I can "see" the
changes in the moment they happen...
I hope I made myself clear enough that some one could help me ;)
Cheers
harkon
|
|
|
|
Re: Access EcoreModel instance [message #416455 is a reply to message #416423] |
Fri, 01 February 2008 14:47 |
Eclipse User |
|
|
|
Originally posted by: harkon.ogame.gmail.com
Hi Ed!
Yes, my intention is to make a m2m transformation on Ecore models and to
see the changes on the fly.
Okay, all editors implement the interface you mentioned below but now:
The user chooses which model is the source and which one is the
destiantion. This decision is made via a workspace browser and the files
are selected.
After that decision the model shall be opened with the default editor
(e.g. Ecore Model Editor).
Maybe one model is already opened.
How to find now the corresponding editor? And above all how to
automatically open a file in an editor from another plugin?
Hmm, weird ;)
Cheers
harkon
Ed Merks wrote:
> Harkon,
> Comments below.
> harkon wrote:
>> Hi everybody...
>>
>> I encountered a problem in accessing an instance of a Ecore modell
>> residing in my workspace of Eclipse.
>>
>> Situation: I want to access an Ecore Modell from a newly created
>> Plugin existing in the current Eclipse instance. This can be done via
>> an URL file based. if I now open die URL I can access the content and
>> everything is fine.
>>
>> Now if an Ecore Model editor is open in the same time the model won't
>> be updated immediately. I have to refresh the display.
> You haven't talked about making modifications yet, so I'm missing the
> connection or a step as to why the display needs refreshing.
>>
>> Question: The Ecore Model Editor owns a Ecore Model reference itself
>> (EObject root node). How can I access this root node of the opened
>> Ecore Model Editor?
> All generated editors implement IEditingDomainProvider so you can cast
> the editor to that, get the editing domain, and from that you have
> access to the resource set in which all the resources being edited are kept.
>> The background is: I want to alter the content of an Ecore model via
>> EMF techniques and whenever a change was registered the EMF fires
>> various events about this update and the Ecore Model Editor changes
>> its display "on the fly".
> Be sure to use the command stack of the editing domain to make all your
> changes so that the editor can undo the changes and knows that it's
> dirty and needs to save.
>> Now if I change the model from another Eclipse Plugin via this root
>> node instance of the opened Ecore Model Editor I can "see" the changes
>> in the moment they happen...
>>
>> I hope I made myself clear enough that some one could help me ;)
>>
>> Cheers
>> harkon
>>
|
|
|
Re: Access EcoreModel instance [message #416459 is a reply to message #416455] |
Fri, 01 February 2008 17:16 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Karkon,
Comments below.
harkon wrote:
> Hi Ed!
>
> Yes, my intention is to make a m2m transformation on Ecore models and
> to see the changes on the fly.
>
> Okay, all editors implement the interface you mentioned below but now:
> The user chooses which model is the source and which one is the
> destiantion. This decision is made via a workspace browser and the
> files are selected.
>
> After that decision the model shall be opened with the default editor
> (e.g. Ecore Model Editor).
>
> Maybe one model is already opened.
>
> How to find now the corresponding editor?
Each workbench page provides access to all the open editors, so I guess
you could scan them all...
> And above all how to automatically open a file in an editor from
> another plugin?
The generated wizard's performFinish shows how to do that.
I could imagine another way to implement such a thing is as a popup
action on an EPackage...
>
> Hmm, weird ;)
>
> Cheers
> harkon
>
> Ed Merks wrote:
>
>> Harkon,
>
>> Comments below.
>
>
>> harkon wrote:
>>> Hi everybody...
>>>
>>> I encountered a problem in accessing an instance of a Ecore modell
>>> residing in my workspace of Eclipse.
>>>
>>> Situation: I want to access an Ecore Modell from a newly created
>>> Plugin existing in the current Eclipse instance. This can be done
>>> via an URL file based. if I now open die URL I can access the
>>> content and everything is fine.
>>>
>>> Now if an Ecore Model editor is open in the same time the model
>>> won't be updated immediately. I have to refresh the display.
>> You haven't talked about making modifications yet, so I'm missing the
>> connection or a step as to why the display needs refreshing.
>>>
>>> Question: The Ecore Model Editor owns a Ecore Model reference itself
>>> (EObject root node). How can I access this root node of the opened
>>> Ecore Model Editor?
>> All generated editors implement IEditingDomainProvider so you can
>> cast the editor to that, get the editing domain, and from that you
>> have access to the resource set in which all the resources being
>> edited are kept.
>>> The background is: I want to alter the content of an Ecore model via
>>> EMF techniques and whenever a change was registered the EMF fires
>>> various events about this update and the Ecore Model Editor changes
>>> its display "on the fly".
>> Be sure to use the command stack of the editing domain to make all
>> your changes so that the editor can undo the changes and knows that
>> it's dirty and needs to save.
>>> Now if I change the model from another Eclipse Plugin via this root
>>> node instance of the opened Ecore Model Editor I can "see" the
>>> changes in the moment they happen...
>>>
>>> I hope I made myself clear enough that some one could help me ;)
>>>
>>> Cheers
>>> harkon
>>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Access EcoreModel instance [message #416465 is a reply to message #416459] |
Sun, 03 February 2008 14:00 |
Eclipse User |
|
|
|
Originally posted by: harkon.ogame.gmail.com
Hi Ed!
You wrote:
>>> All generated editors implement IEditingDomainProvider so you can
>>> cast the editor to that, get the editing domain, and from that you
>>> have access to the resource set in which all the resources being
>>> edited are kept.
Yes - now I see it ;) and i can cast it... But now how to access the
EObject within?
I find no way to even identify the correct class -.-
Can I iterate to all EObjects within the model via this resource set?
Cheers
harkon
|
|
|
|
Powered by
FUDForum. Page generated in 0.03478 seconds