Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Eclipse 4 with both views (3.x and e4)
Eclipse 4 with both views (3.x and e4) [message #1021251] Tue, 19 March 2013 18:33 Go to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 194
Registered: October 2010
Senior Member
I hope someone can help me with a problem I have because I've tried eclipse forum two or three times and I got nothing.

My E4RCP uses two graphiti editors (3.x based) which contribute to properties view (also 3.x based).

I developed two more e4 views, and I want them to contribute to properties view.

I understand my e4 views should use selection service as described in or, and I see that properties view use the old fashioned way to retrive active selection from views which propapagate selection like this:

private void attachSelectionProvider() {
IWorkbenchPartSite partSite = getSite();

So, the question is: How do I make my e4 views contribute to properties view (3.x)?
I surely can't do something like
partSite.setSelectionProvider(contactsViewer) in pure e4 view, to forward active selection, and I can't change properties view.

I made some experiences where e4 view use selection service, but properties view doesnt catch it, because I think compatibily layer doesnt forward e4 selections.

Any advises
I'd be very appreciate if someone can help me.

Is it true my whole application has to be 3.x anyway?

Thanks in advance
rui domingues
Re: Eclipse 4 with both views (3.x and e4) [message #1021364 is a reply to message #1021251] Tue, 19 March 2013 23:40 Go to previous messageGo to next message
Davy Meers is currently offline Davy MeersFriend
Messages: 2
Registered: December 2010
Junior Member
Hello Rui,

i took some time to look a few things up and i might have a possible way to bridge the RCP3 and E4 selection handling. Unfortunately i currently have very little time, that's why i didn't code it to see if it works.

My idea in short:

Create an implementation of the RCP3 ISelectionProvider that listens to the E4 ISelectionService and add it to the RCP3 IWorkbenchPartSite.

A bit more elaborate:

As you know in RCP3 you propagate selection using "IWorkbenchSite.setSelectionProvider(ISelectionProvider provider)" [1].

Something to try is to let your E4 view implement "ISelectionProvider" [2].
In some rcp3 code you retrieve this view using the E4 Model Service [3].
You can get a hold of that service using "getViewSite().getServices()" (this is part of the compatibility layer if i am not mistaken) [4].
You then add that view as a ISelectionprovider to the IWorkbenchSite.

Another possibility is to create an adapter in some RCP3 code that implements rcp3's "ISelectionProvider" and E4's ISelectionListener [5].
This adapter retrieves the E4 ESelectionService [6] (using "getViewSite().getServices()") and adds itself to it as a ISelectionListener.
It also adds itself as a ISelectionProvider to the IWorkbenchSite.

The key point is to have an ISelectionProvider that listens to the E4 ESelectionService.
To achieve this i think the easiest is to to use "getViewSite().getServices()" to get hold of E4 Application services in RCP3 code.

As i said i don't have time to experiment and execute the idea's i have.
So there might be roadblocks but i do hope it will help you to solve the problem.


Re: Eclipse 4 with both views (3.x and e4) [message #1022731 is a reply to message #1021364] Fri, 22 March 2013 12:45 Go to previous message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 194
Registered: October 2010
Senior Member
Hi. Tks for replying.

I agree, but I think there's a problem:
E4 SelectionService (org.eclipse.ui.internal.e4.compatibility.SelectionService) notifies the listeners only if part is CompatibiltyPart, sa we can see in this code:

Object client = part.getObject();
	if (client instanceof CompatibilityPart) {
	 IWorkbenchPart workbenchPart = ((CompatibilityPart) client).getPart();
	 notifyListeners(part.getElementId(), workbenchPart, (ISelection) selection);
if (page != null) {

So I think this is not possible.
Previous Topic:Drag and Drop UI application using e4
Next Topic:Menu disabled in RCP with Kepler M4
Goto Forum:

Current Time: Fri Jun 22 05:44:53 GMT 2018

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

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

Back to the top