Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » IWorkbenchPart.setFocus() not called on Mac OS X 10.66
IWorkbenchPart.setFocus() not called on Mac OS X 10.66 [message #671685] Wed, 18 May 2011 16:56 Go to next message
Eclipse UserFriend
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 #671690 is a reply to message #671685] Wed, 18 May 2011 17:19 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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 #671865 is a reply to message #671690] Thu, 19 May 2011 08:16 Go to previous messageGo to next message
Eclipse UserFriend
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 15:09 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Previous Topic:Re: I would like to remove windows menu in textbox
Next Topic:Non-resizing a standalone view
Goto Forum:
  


Current Time: Mon Apr 06 03:23:19 GMT 2020

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

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

Back to the top