Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Mouse listener on tab item of a workbench part
Mouse listener on tab item of a workbench part [message #660247] Thu, 17 March 2011 14:38 Go to next message
Anders Baumann is currently offline Anders BaumannFriend
Messages: 7
Registered: March 2011
Junior Member
Hi All.
How do I add a mouse listener to the tab item of a workbench part? I need to be notified about any mouse click on the tab not just when the workbench part is activated.

As far as I can see the tab item is created deep inside the StackPrensentation so how do I get hold of it so that I can attach a mouse listener to it?

Thanks in advance,
Anders
Re: Mouse listener on tab item of a workbench part [message #660360 is a reply to message #660247] Fri, 18 March 2011 06:18 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
On 17/03/11 8:08 PM, Anders wrote:
> Hi All.
> How do I add a mouse listener to the tab item of a workbench part? I
> need to be notified about any mouse click on the tab not just when the
> workbench part is activated.
>
> As far as I can see the tab item is created deep inside the
> StackPrensentation so how do I get hold of it so that I can attach a
> mouse listener to it?

I don't think its accessible via API. What is your usecase?

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: Mouse listener on tab item of a workbench part [message #660381 is a reply to message #660360] Fri, 18 March 2011 08:48 Go to previous messageGo to next message
Anders Baumann is currently offline Anders BaumannFriend
Messages: 7
Registered: March 2011
Junior Member
Hi Prakash.
The use case is that when I click on the tab of the editor then I need to put focus to a specific component.

Best regards,
Anders
Re: Mouse listener on tab item of a workbench part [message #660417 is a reply to message #660381] Fri, 18 March 2011 11:07 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
On 18/03/11 2:18 PM, Anders wrote:
> Hi Prakash.
> The use case is that when I click on the tab of the editor then I need
> to put focus to a specific component.

Can't you override editorPart.setFocus() to do that?

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: Mouse listener on tab item of a workbench part [message #660483 is a reply to message #660417] Fri, 18 March 2011 15:34 Go to previous messageGo to next message
Anders Baumann is currently offline Anders BaumannFriend
Messages: 7
Registered: March 2011
Junior Member
Unfortunately no, because WorkbenchPart#setFocus is only called when the editor becomes the active editor. Not when it already is the active editor.
Re: Mouse listener on tab item of a workbench part [message #660516 is a reply to message #660247] Fri, 18 March 2011 19:59 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 03/17/2011 10:38 AM, Anders wrote:
> Hi All.
> How do I add a mouse listener to the tab item of a workbench part? I
> need to be notified about any mouse click on the tab not just when the
> workbench part is activated.

As Prakash mentioned, there's just now way to interact with the tab in
the editor or view stack, unless you create them yourself.

When your part is activated, setFocus() will be called. Except for
when the editor is already the active part, you'll get the call.

Re-clicking on the active part to change focus is not a common pattern
within an editor/view.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Mouse listener on tab item of a workbench part [message #667328 is a reply to message #660516] Thu, 28 April 2011 07:40 Go to previous messageGo to next message
Anders Baumann is currently offline Anders BaumannFriend
Messages: 7
Registered: March 2011
Junior Member
Hi Paul.
But what about the scenario where focus goes to another part of the workbench and then the tab of the editor is clicked? For instance, in the Eclipse IDE I click in the "Package Explorer" view. The focus frame is moved to this view. Then I click on the tab of the active editor and the focus frame is now moved to the editor. How is this implemented.

Thanks in advance,
Anders
Re: Mouse listener on tab item of a workbench part [message #667382 is a reply to message #667328] Thu, 28 April 2011 12:42 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

That's what IWorkbenchPart#setFocus() is for. If a user clicks in a
view, the user has picked the focus widget.

If the user clicks on a tab or uses F6 to activate a view, the workbench
calls setFocus() on the view part to give it a chance to set focus on
one of its widgets.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:Deploy eclipse plugin
Next Topic:Problem with updating the plugin created by me
Goto Forum:
  


Current Time: Tue Apr 23 07:27:02 GMT 2024

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

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

Back to the top