Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Creating a Model Navigator for an EMF Model
Creating a Model Navigator for an EMF Model [message #512702] Sat, 06 February 2010 16:08 Go to next message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

Hi,

I'm trying to create a Navigator View (preferably using Eclipse CNF) for my RCP application GMF-based (over an EMF model, of course).

My needs are:

- display only my model objects in the tree
- having them represented in a GMF Diagram
- having them bounded with diagram and property sheet
- the input has to be not resource-based (e.g., a file), but instead created via Java code

Based on book "Eclipse Modeling Framework" by Eclipse Series, I've initially created a simple ViewPart and a TreeViewer with the following code:

adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);

adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new [MyProjectName]ItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());

treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));

treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));


and then I've set the TreeViewer input with my EMF model.
This way I can see my (code created) model objects, but they are not linked with PropertySheetPage. Besides, if I open a GMF Diagram filled with my objects, I'm not able to have the tree refreshed if I add some object graphically.

So, i'm lost now.....is this the right way to suite my needs?
Re: Creating a Model Navigator for an EMF Model [message #512717 is a reply to message #512702] Sat, 06 February 2010 18:00 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Giovanni,

Comments below.

giovanni wrote:
> Hi,
>
> I'm trying to create a Navigator View (preferably using Eclipse CNF)
> for my RCP application GMF-based (over an EMF model, of course).
> My needs are:
>
> - display only my model objects in the tree
> - having them represented in a GMF Diagram
> - having them bounded with diagram and property sheet
> - the input has to be not resource-based (e.g., a file), but instead
> created via Java code
I'm not sure how well GMF works without a workspace. In fact, I'm not
sure it does.

>
> Based on book "Eclipse Modeling Framework" by Eclipse Series, I've
> initially created a simple ViewPart and a TreeViewer with the
> following code:
>
> adapterFactory = new
> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg
> istry.INSTANCE);
>
> adapterFactory.addAdapterFactory(new
> ResourceItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new
> [MyProjectName]ItemProviderAdapterFactory());
> adapterFactory.addAdapterFactory(new
> ReflectiveItemProviderAdapterFactory());
>
> treeViewer.setContentProvider(new
> AdapterFactoryContentProvider(adapterFactory));
>
> treeViewer.setLabelProvider(new
> AdapterFactoryLabelProvider(adapterFactory));
>
> and then I've set the TreeViewer input with my EMF model.
> This way I can see my (code created) model objects, but they are not
> linked with PropertySheetPage.
Look at the generated EMF editor to see how it hooks to the property
sheet page. E.g., getAdapter.
> Besides, if I open a GMF Diagram filled with my objects, I'm not able
> to have the tree refreshed if I add some object graphically.
Maybe you can look at how Ecore Tools solves this problem. The editor
would need to share the same instance objects as are used in the CNF.
>
> So, i'm lost now.....is this the right way to suite my needs?


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF Builder
Next Topic:EMF model validation fails, but model seems valid. Please help, I'm stuck :-)
Goto Forum:
  


Current Time: Thu Sep 26 08:04:37 GMT 2024

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

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

Back to the top