Skip to main content



      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 11:08 Go to next message
Eclipse UserFriend
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 13:00 Go to previous message
Eclipse UserFriend
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?
Previous Topic:EMF Builder
Next Topic:EMF model validation fails, but model seems valid. Please help, I'm stuck :-)
Goto Forum:
  


Current Time: Sun Jul 20 02:39:54 EDT 2025

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

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

Back to the top