Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 375305 - org.eclipse.ui.internal.PartPane does no longer allows access to its toolbar
Summary: org.eclipse.ui.internal.PartPane does no longer allows access to its toolbar
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-26 07:49 EDT by Marvin Mueller CLA
Modified: 2012-07-11 11:53 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marvin Mueller CLA 2012-03-26 07:49:32 EDT
Build Identifier: 4.2.0.v20120315-1300

We, the Jubula team, currently check the compatibility of testing 3.x applications / plugins with e4.2 + compatibility layer and noticed that some internal classes have changed which we require for UI automation.

E.g. the method org.eclipse.ui.internal.PartPane.getToolBar() does no longer exist. Which is the correct approach to access this toolbar in an 3.x / e4.2 compatible way?

This results in 
 a) an exception (NoSuchMethod) being thrown in the e4 application when our remote control component (org.eclipse.jubula.rc.rcp) bundle is present.
 b) an even more severe problem: preventing Jubula from testing those components.

Reproducible: Always
Comment 1 Paul Webster CLA 2012-03-26 08:02:49 EDT
The view toolbar itself is not (and has never) been exposed via API.  You can't get access to it (at least not legally).

Other hacks that may or may not work: crawl the widget hierarchy from the shell to find it.  It's fairly dynamic in nature, so there's a lot of looking at CTabFolder's controls to find it or its parent container.

Find the Part's MToolBar, get its widget, and it's either the toolbar or a composite that contains the toolbar (renderer specific).

Get the view site, the action bar, and then the IToolBarManager.  If it's an instance of ToolBarManager you can try getControl().  The implementation of IToolBarManager can be swapped out at any time, although that's not planned for Juno (but I couldn't guarantee it).

PW
Comment 2 Marvin Mueller CLA 2012-03-26 08:16:57 EDT
Thanks for your quick reply and your hints. We will check our code.

Thank you
MM
Comment 3 Paul Webster CLA 2012-03-26 08:42:39 EDT
(In reply to comment #1)
> 
> Get the view site, the action bar, and then the IToolBarManager.  If it's an
> instance of ToolBarManager you can try getControl().  The implementation of
> IToolBarManager can be swapped out at any time, although that's not planned for
> Juno (but I couldn't guarantee it).

I'll just note that this hack is the most likely to work in both 3.x and 4.x.  The trick would be to request the toolbar every time you need it, as in 4.x it can get disposed and recreated.

PW