Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Access the model instance in the EMF generated editor
Access the model instance in the EMF generated editor [message #414593] Wed, 14 November 2007 10:36 Go to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Hi there,

I generated all code from an Ecore Metamodel, i.e. Model, Edit and
Editor code. Running the Editor Plugin, I can use the different default
vierwers (e.g. tree viewer to view and edit my model instance).

Now I want to add a new page to this editor with a custom canvas. How
can I actually access the model instance within the editor? I don't find
a reference to it in the editor code. All I see is the EditorInput,
which is simply the file of the model. Do I have to load the instance
manually?

I understand the other viewers are of type Viewer and use the Edit Code
Adapters as Label and Content Providers. So do I need to implement a
real Viewer with using also some kind of custom providers or can I get
the instance of my model some other way?

Cheers,
Hauke
Re: Access the model instance in the EMF generated editor [message #414597 is a reply to message #414593] Wed, 14 November 2007 10:57 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Hauke,

Each generated EMF editor implements IEditingDomainProvider, which
allows you to call
<editor> .getEditingDomain().getResourceSet().getResources().get(0).g etContents().get(0)
to get at the firest root object of the first resource of the resource set.


Hauke Fuhrmann wrote:
> Hi there,
>
> I generated all code from an Ecore Metamodel, i.e. Model, Edit and
> Editor code. Running the Editor Plugin, I can use the different default
> vierwers (e.g. tree viewer to view and edit my model instance).
>
> Now I want to add a new page to this editor with a custom canvas. How
> can I actually access the model instance within the editor? I don't find
> a reference to it in the editor code. All I see is the EditorInput,
> which is simply the file of the model. Do I have to load the instance
> manually?
>
> I understand the other viewers are of type Viewer and use the Edit Code
> Adapters as Label and Content Providers. So do I need to implement a
> real Viewer with using also some kind of custom providers or can I get
> the instance of my model some other way?
>
> Cheers,
> Hauke
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:derived attribute implementation
Next Topic:about JavaSpider
Goto Forum:
  


Current Time: Thu Apr 18 14:55:33 GMT 2024

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

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

Back to the top