Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » E4Application ActiveChild RAT(why does it also track ACTIVE_SELECTION?)
E4Application ActiveChild RAT [message #1755763] Tue, 07 March 2017 16:42 Go to next message
Darrel Karisch is currently offline Darrel KarischFriend
Messages: 14
Registered: July 2012
Junior Member
is it the intent of E4Application.initializeApplicationServices ActiveChild RAT to also track the selection?

I don't think this is right. shouldn't this be avoided?

event	org.eclipse.e4.core.internal.contexts.ContextChangeEvent 
	context	org.eclipse.e4.core.internal.contexts.EclipseContext	(TrimmedWindowContext)
	key	"org.eclipse.ui.selection"	
	oldValue	EditorSelection  	
runnable	org.eclipse.e4.core.internal.contexts.TrackableComputationExt
	originatingContext	org.eclipse.e4.core.internal.contexts.EclipseContext	(id=22326)
	runnable	org.eclipse.e4.ui.internal.workbench.swt.E4Application$4 
		val$theContext	org.eclipse.e4.core.internal.contexts.EclipseContext  (id=22326)

	static public void initializeApplicationServices(IEclipseContext appContext) {
		final IEclipseContext theContext = appContext;
		// we add a special tracker to bring up current selection from
		// the active window to the application level
		appContext.runAndTrack(new RunAndTrack() {
			@Override
			public boolean changed(IEclipseContext context) {
				IEclipseContext activeChildContext = context.getActiveChild();
				if (activeChildContext != null) add runExternalCode here {
					Object selection = activeChildContext.get(IServiceConstants.ACTIVE_SELECTION);
					theContext.set(IServiceConstants.ACTIVE_SELECTION, selection);
				}
				return true;
			}
		});



Re: E4Application ActiveChild RAT [message #1755888 is a reply to message #1755763] Thu, 09 March 2017 01:41 Go to previous messageGo to next message
Eclipse UserFriend
Hi Darrel. That code seems to be doing what you're describing. Why do you think it's bad?

Each window maintains an active selection too, which is populated by the out-selection of the active part.

Brian.
Re: E4Application ActiveChild RAT [message #1776356 is a reply to message #1755888] Wed, 15 November 2017 16:06 Go to previous messageGo to next message
Darrel Karisch is currently offline Darrel KarischFriend
Messages: 14
Registered: July 2012
Junior Member
Thanks for the prompt response.

It seems to defy the comment: "we add a special tracker to bring up current selection from the active window to the application level"

This implies to me that the intent is to track only EclipseContext.ACTIVE_CHILD and not IServiceConstants.ACTIVE_SELECTION

adding runExternalCode will prevent tracking IServiceConstants.ACTIVE_SELECTION

sorry for my delay in responding.
Re: E4Application ActiveChild RAT [message #1776778 is a reply to message #1776356] Tue, 21 November 2017 14:52 Go to previous message
Eclipse UserFriend
We need to track the active child to detect when another window takes focus.
We need to track the active selection for the active window's context to detect changes to the selection while a part is active.

The RATs only track the values fetched. When the active window changes, we no longer request the active selection from the old window, so we won't be alerted to changes from the old window.

Are you seeing something different?
Previous Topic:Make Perspective from Model Fragment as pre-defined
Next Topic:E4 is constantly destroying workspaces
Goto Forum:
  


Current Time: Tue Apr 16 08:16:49 GMT 2024

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

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

Back to the top