Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Using e3 properties view in e4 RCP application(How to display selected "e4 elements" in my "e3 property view")
Using e3 properties view in e4 RCP application [message #1060666] Mon, 27 May 2013 15:23 Go to next message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 176
Registered: September 2011
Senior Member
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
Re: Using e3 properties view in e4 RCP application [message #1065364 is a reply to message #1060666] Tue, 25 June 2013 12:54 Go to previous message
maarten meijer is currently offline maarten meijerFriend
Messages: 145
Registered: July 2009
Senior Member
I have the exact same problem: AdapterFactory not called
Previous Topic:E4 Command Parameter Object Type
Next Topic:Overwrite default keybindings
Goto Forum:
  


Current Time: Sat Nov 22 23:55:50 GMT 2014

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

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