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 Domingues
Messages: 193
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 http://www.vogella.com/articles/Eclipse4Services/article.html or http://wiki.eclipse.org/E4/EAS/Selection, 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();
partSite.setSelectionProvider(contactsViewer);
}

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 Meers
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.

Regards,
Davy


[1] http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IWorkbenchSite.html
[2] http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjface%2Fviewers%2FISelectionProvider.html
[3] http://wiki.eclipse.org/E4/EAS/Model_Service
[4] https://bugs.eclipse.org/bugs/show_bug.cgi?id=356557
[5] http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/modeling/ISelectionListener.java
[6] http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/modeling/ESelectionService.java
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 Domingues
Messages: 193
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) {
	page.updateShowInSources(part);
}


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


Current Time: Thu Oct 23 20:40:21 GMT 2014

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

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