Esteban,
It's best to use the EMF newsgroup. I've added it to the "to" list of
the reply.
Esteban DUGUEPEROUX wrote:
Hi,
I post here because I don't know which group is adapted.
I have a view componed of a TreeViewer with as input a tree of EObject
from my generated Ecore model.
I want see properties of my selected item (EObject) of my TreeViewer in
PropertySheet Viewer, then I have added this line :
getSite().setSelectionProvider(viewer);
but I need that my EObjects implements IAdaptable or IPropertySource
following this article :
http://www.eclipse.org/articles/Article-Properties-View/properties-view.html
No you don't need that. The generated editor already shows how this is
supported using an AdapterFactoryContentProvider:
/**
* This accesses a cached version of the property sheet.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IPropertySheetPage getPropertySheetPage()
{
if (propertySheetPage == null)
{
propertySheetPage =
new ExtendedPropertySheetPage(editingDomain)
{
@Override
public void setSelectionToViewer(List<?>
selection)
{
LibraryEditor.this.setSelectionToViewer(selection);
LibraryEditor.this.setFocus();
}
@Override
public void setActionBars(IActionBars actionBars)
{
super.setActionBars(actionBars);
getActionBarContributor().shareGlobalActions(this,
actionBars);
}
};
propertySheetPage.setPropertySourceProvider(new
AdapterFactoryContentProvider(adapterFactory));
}
return propertySheetPage;
}
How can I specify to my .genmodel to generate EObject implementing one
of these above interfaces with default implementations.
EMF has an adapter mechanism already; one that includes support for
notification as well.
I have to manually add one of these interfaces to my Ecore generated
code?
There are definitely automatic ways you could support this, for example
by extending EObjectImpl with something that supports additional
interfaces, and then using that base class in place of EObjectImpl. in
the GenModel Root Extends Class property.
It sounds like it would be a good idea for you to generate the editor
and see how it works...
Regards
|