Using e3 properties view in e4 RCP application [message #1060666] |
Mon, 27 May 2013 11:23  |
Eclipse User |
|
|
|
Hi all,
I've been struggling for a couple of days on the following problem so I hope somebody can help...
I built a small e4 RCP application containing both an "e4 home made" browser and an "e3 properties view".
I mixed e3 and e4 following "dirksmetric tutorial" and got a functionning browser displayed together with an empty property view.
To get a browser selected element displayed in my porperty sheet, I did the following things :
- On my e4 browser side, I use the e4 selection service in #createPartControl :
// Register the viewer as a selection provider (to be consumed by the property view...)
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
// set the selection to the service
selectionService.setSelection(
selection.size() == 1? selection.getFirstElement(): selection.toArray());
}
});
- On the e3 "classical" property sheet side, I defined a couple of things :
1. I called IDE.registerAdapters in my ApplicationWorkbenchAdvisor#initialize.
2. I declared my property source adapter as follow in my plugin.xml :
<extension
point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.eclipse.emf.ecore.EObject"
class="myappmodeler.properties.ModelPropertiesAdapter">
<adapter
type="org.eclipse.ui.views.properties.IPropertySource">
</adapter>
</factory>
</extension>
3. My ModelPropertiesAdapter#getAdapter returns a property source :
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adapterType== IPropertySource.class && adaptableObject instanceof EObject){
emfGlobalFactory = new ComposedAdapterFactory();
emfGlobalFactory.addAdapterFactory(new RepositorystructureItemProviderAdapterFactory());
emfGlobalFactory.addAdapterFactory(new ApplicationItemProviderAdapterFactory());
emfGlobalFactory.addAdapterFactory(new ServiceItemProviderAdapterFactory());
return new AdapterFactoryContentProvider(emfGlobalFactory).getPropertySource(adaptableObject);
}
return null;
}
My problem is this adapter is not even executed.
So, I don't know how to "link" my "e4" selection with the "e3" adapter execution so that (hopefully) my properties get displayed.
Kind regards,
Laurent
|
|
|
|
Powered by
FUDForum. Page generated in 0.07081 seconds