IWorkbenchPart.setFocus() not called on Mac OS X 10.66 [message #671685] |
Wed, 18 May 2011 12:56  |
Eclipse User |
|
|
|
Originally posted by: Esteban DUGUEPEROUX
Hi,
I have a Eclipse based application with a editor, this editor overrides
the IWorkbenchPart.setFocus() operation to do some stuffs. On
Linux/Windows, having two editors (EMF editor for example) on the same
file, the two editors are side by side (using EditorSashContainer),
starting with the focus on the first editor, then changing the focus on
the second editor (by clicking on the tab of the editor) calls
IWorkbenchPart.setFocus() on the second editor (OK), changing the focus
by clicking in the middle of the second editor calls
IWorkbenchPart.setFocus() (OK). But not on Mac OS X (10.66) for the
second case, clicking in the middle of the second editor doesn't calls
IWorkbenchPart.setFocus() (KO).
This issue was reproduced on helios.
By debugging, we can see a difference in PartPane.setFocus(),
SwtUtil.isFocusAncestor() returns true on Mac while returns false on
Linux/Windows.
This seems a swt mac fragment bug, but can't find where.
Best Regards.
|
|
|
|
Re: IWorkbenchPart.setFocus() not called on Mac OS X 10.66 [message #671865 is a reply to message #671690] |
Thu, 19 May 2011 04:16   |
Eclipse User |
|
|
|
Originally posted by: Esteban DUGUEPEROUX
Hi,
Thanks for your fast reply, indeed I can use
IPartListener2.partActivated() even IPartListener.partActivated() to do
my stuffs, but about the IWorkbenchPart.setFocus() there is yet a
behaviour difference between Linux/Windows & Mac for EcoreEditor for
example, where the setFocus() is not called on Mac when clicking in the
middle while it is called on Linux/Windows.
Best Regards.
On 18/05/2011 19:19, Paul Webster wrote:
> Just FYI. The contract for org.eclipse.ui.IWorkbenchPart.setFocus() is
> to allow the part to assign focus to one of its child controls. That's it.
>
> And that's because if the workbench activates a part (programmatically,
> or because the part's tab was selected) we'll call this method. But if
> the user clicks in a control in the part, we usually don't call this
> method (the control already has focus, it's redundant).
>
> If you need to perform actions other than myControl.setFocus() on part
> activation, you should use an IPartListener2.
>
> PW
>
|
|
|
Re: IWorkbenchPart.setFocus() not called on Mac OS X 10.66 [message #672012 is a reply to message #671865] |
Thu, 19 May 2011 11:09  |
Eclipse User |
|
|
|
While that may be true, we only specify that clicking on a tab or a programmatic activation will call setFocus(), because the part needs the focus to be in itself, not in the tab. If the focus control is already in the part, the call is not needed.
The extra event seems to be a button press event on the linux side (for a Text widget anyway). I'm not sure why, but it's not important for the purposes of setFocus() as long as the focus control ends up as the one the user clicks (I did a test, and it appears correct in linux).
PW
|
|
|
Powered by
FUDForum. Page generated in 0.08986 seconds