Setting focus to another part programmatically [message #1718292] |
Tue, 22 December 2015 07:55 |
|
I am trying to move the focus from one part to another part. I tried:
partService.activate(part, true);
My part has the following code:
@Focus
public void onFocus() {
getViewer().getControl().setFocus();
}
But this is never called. What am I doing wrong?
Thanx in advance
Mihael
|
|
|
Re: Setting focus to another part programmatically [message #1718350 is a reply to message #1718292] |
Tue, 22 December 2015 18:08 |
Eclipse User |
|
|
|
Try enabling the DI tracing options (launch configuration dialog > Tracing > org.eclipse.e4.core.di for debug/injector) and see if there's an issue when invoking the method.
Otherwise please post an example demonstrating the problem. You're simply not providing sufficient context to narrow down the problem.
Brian.
|
|
|
Re: Setting focus to another part programmatically [message #1718389 is a reply to message #1718350] |
Wed, 23 December 2015 09:14 |
|
Sorry for not being able to give enough info. I am a bit under pressure for making a release.
I have done some more testing and can confirm that it does not happen on all platforms. On windows (win 7 64bit) it works. On linux (debian 7 64 bit openbox) it works partially.
If I am using a double click action from one part to focus another part it doesn't work on my linux desktop. If I use a popup menu entry from one part to activate and focus another part it also works on linux.
I can also confirm that the method which is annotated with @Focus is called every time.
I hope it helps.
Mihael
|
|
|
|
Re: Setting focus to another part programmatically [message #1718396 is a reply to message #1718393] |
Wed, 23 December 2015 11:05 |
|
Thomas Schindl wrote on Wed, 23 December 2015 11:06have you tried simply delaying the focus transferal by scheduling a
asyncExec? I think the problem on Linux is that everything involved is
inheritly async and eg mouse-events are delivered not in the same
dispatch (although already scheduled on the event-queue), an asyncExec
would make sure that all the focus transfer is after all other events.
Wow. I am impressed by your deep knowledge. You hit the nail on the head. Wrapping it up into an asyncExec worked.
Thanx very much.
Mihael
|
|
|
Powered by
FUDForum. Page generated in 0.17283 seconds