Skip to main content



      Home
Home » Eclipse Projects » e(fx)clipse » Activation of the window context
Activation of the window context [message #1349992] Mon, 12 May 2014 08:53 Go to next message
Eclipse UserFriend
Hi,
In our code we programatically play with E4 and we need to switch window (hide one and show another) and create a part in new window. We are doing that in following way:
MWindow newWindow = ... newWindow.setToBeRendered(true);
newWindow.setVisible(true);
(...)
partService.createPart(partId);

That works perfectly in Windows, but in Linux the creation of the part fails. After investigation it seems that the problem is that in Linux the context of the new window is not activated immediatelly (in current thread) because it is done when the window gets focus. In Linux this event comes asynchronously. For Windows the event is synchronous and context is activated when we return from MWindow.setVisible(..). If I'm corrent this all happens in DefWindowRenderer.WWindowImpl.handledFocus(ObservableValue<? extends Boolean>, Boolean, Boolean).

Please look at the answer from the Glass developers for JIRA RT-36913 open in JavaFX JIRA (I can't put link here).The question is: if "Applications should not introduce any logic that depends on this" (that is focus event delivery) should e(fx)clipse activate the window context after receiving this event?
Re: Activation of the window context [message #1350160 is a reply to message #1349992] Mon, 12 May 2014 10:26 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Please file a bugzilla and attach a test case I can use to reproduce the
problem. If I got you right the partService-call fails because you'll
have to wait for the window to get focus?

Tom

On 12.05.14 15:40, Jacek Bukowski wrote:
> Hi, In our code we programatically play with E4 and we need to switch
> window (hide one and show another) and create a part in new window. We
> are doing that in following way:
> MWindow newWindow = ... newWindow.setToBeRendered(true);
> newWindow.setVisible(true);
> (...)
> partService.createPart(partId);
>
> That works perfectly in Windows, but in Linux the creation of the part
> fails. After investigation it seems that the problem is that in Linux
> the context of the new window is not activated immediatelly (in current
> thread) because it is done when the window gets focus. In Linux this
> event comes asynchronously. For Windows the event is synchronous and
> context is activated when we return from MWindow.setVisible(..). If I'm
> corrent this all happens in
> DefWindowRenderer.WWindowImpl.handledFocus(ObservableValue<? extends
> Boolean>, Boolean, Boolean).
>
> Please look at the answer from the Glass developers for JIRA RT-36913
> open in JavaFX JIRA (I can't put link here).The question is: if
> "Applications should not introduce any logic that depends on this" (that
> is focus event delivery) should e(fx)clipse activate the window context
> after receiving this event?
Re: Activation of the window context [message #1357550 is a reply to message #1350160] Thu, 15 May 2014 11:22 Go to previous messageGo to next message
Eclipse UserFriend
Yes, until the window gets focused the context is not activated and I cannot create a part. I will file a bugzilla issue for that, thanks.
Re: Activation of the window context [message #1369017 is a reply to message #1357550] Tue, 20 May 2014 07:31 Go to previous messageGo to next message
Eclipse UserFriend
The bug is here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=435273

Regards,
Jacek
Re: Activation of the window context [message #1371399 is a reply to message #1369017] Wed, 21 May 2014 06:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I've fixed the bug. For those interested I think it is important that
one can not expect always that things are synchronous - even on none
Linux platforms.

The reason for it is that we provide a way to animate e.g. the showing
of a window hence the window is really only shown at the end of the
animation.

So the framework now sends out 3 events via the event broker:
* org.eclipse.fx.ui.services.Constants.WINDOW_SHOWN
* org.eclipse.fx.ui.services.Constants.WINDOW_HIDDEN
* org.eclipse.fx.ui.services.Constants.WINDOW_ACTIVATED

I think the right event in your case is WINDOW_ACTIVATED and proceed
afterwards with the EPartService. One more note on your code, never ever
please using @Inject in handlers, put everything you need into the @Execute!

Tom

On 20.05.14 13:31, Jacek Bukowski wrote:
> The bug is here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=435273
>
> Regards,
> Jacek
Re: Activation of the window context [message #1383977 is a reply to message #1371399] Tue, 27 May 2014 11:48 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for the quick solution. That will let us removing activation in our code (as a workaround). But we should refactor our code to not rely on that.
By the way, I assume that your notice about asynchronous processing is only for windows (because their OS-dependent representation) or operations on lower E4 model elements (like perspectives or parts) can also not always be synchronous?

Jacek
Re: Activation of the window context [message #1384010 is a reply to message #1383977] Tue, 27 May 2014 15:57 Go to previous message
Eclipse UserFriend
Hi,

No those are all synchronous - the only thing to keep in mind is that
when switching perspectives is that they might be animated (it is
up-to-you if that is done) hence I've introduced an event as well.

Tom

On 27.05.14 17:48, Jacek Bukowski wrote:
> Thanks for the quick solution. That will let us removing activation in
> our code (as a workaround). But we should refactor our code to not rely
> on that.
> By the way, I assume that your notice about asynchronous processing is
> only for windows (because their OS-dependent representation) or
> operations on lower E4 model elements (like perspectives or parts) can
> also not always be synchronous?
>
> Jacek
Previous Topic:Classloader Problem with e4fx
Next Topic:[Ann] Nightly builds have DnD support
Goto Forum:
  


Current Time: Fri Apr 18 12:01:37 EDT 2025

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

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

Back to the top