| Add a listener to ViewPart title or title image? [message #696402]
||Wed, 13 July 2011 21:58
| Thomas Hatley
Registered: July 2009
Am trying to replicate an "add" tab that would appear at the end of a group of stacked Views, similar to what you'll see at the top of FireFox or IE (last tab has no text, just a 'plus sign' icon). I have several ViewParts added to an IFolderLayout, which gives a nice row of tabs, each with a title and icon. To simulate a "New View" tab, I created another ViewPart instance, with a name of "" <empty string>, and a default icon showing the 'plus sign', and added this view to the same stack. I'd like to add a listener of some sort (MouseListener or EventListener) to catch a mouse-click on this tab, and fire an Action or Handler.|
My initial attempts were adding the Handler call in the view's getFocus() method, but that doesn't get triggered until the view is brought to the top of the stack...ideally I'd like to catch it before the view is brought to the top. Replicating the FF/IE behavior, the "new window" tab never actually gets displayed, it gets clicked and then moves to the right of the new tab being opened; I'd like to have that same behavior.
I've also tried adding an icon to the toolbar (which a listener can be added to), but the toolbar doesn't show on the ViewPart's tab, it is displayed to the far right, next to the minimize/Maximize buttons, and only when the View it at the front/top of the stack, which I'd like to avoid.
Here's a sketch of what I'm trying to put together (see attachments for screen shots):
_________ _________ __________ ____
| View 1| | View 2| | View 3 | |+ | <--------- "Add View" button
| View 1 Contents Here |
Thanks to all in advance for any thoughts/ideas/suggestions on how this might be accomplished. I've spent quite a bit of time Googling and exploring the Eclipse API & forums for something in the title area that I can attach a listener to. I'm currently on my second RCP project, and will say up front that I'm having a lot of fun and enjoying getting my hands into the inner working of Eclipse
[Updated on: Wed, 13 July 2011 21:59]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.06273 seconds