2012/4/10 Paul Webster <pwebs...@alumni.uwaterloo.ca>

> On Thu, Apr 5, 2012 at 7:32 PM, Matthias Sohn <
> matthias.s...@googlemail.com> wrote:
>
>> I am trying to make the EGit UI tests run on Eclipse 4.2, I can't get
>> over the following
>> problem which seems to be caused by SWTBot using the following method of
>> an
>> internal class org.eclipse.ui.internal.PartPane.getToolBar()
>> which is no longer available in 4.2. This affects quite a number of EGit
>> UI tests.
>>
>> I tried both the Helios and Indigo nightly build versions of SWTBot.
>> I couldn't find any Juno / 4.2 based SWTBot version.
>>
>> Any hints how to fix this ?
>>
>> testCreateCheckoutDeleteLocalBranch(org.eclipse.egit.ui.view.repositories.GitRepositoriesViewBranchHandlingTest)
>>  Time elapsed: 3.965 sec  <<< ERROR!
>> org.eclipse.swt.SWTException: Failed to execute runnable
>> (java.lang.NoSuchMethodError:
>> org.eclipse.ui.internal.PartPane.getToolBar()Lorg/eclipse/swt/widgets/Control;)
>>
>
>
> They'd need to replace that code with something like:
>
> ToolBar toolbar = null;
> IToolBarManager t =
> ((IViewSite)part.getSite()).getActionBars().getToolBarManager();
> if (t instanceof ToolBarManager) {
>     toolbar = ((ToolBarManager)t).getControl();
> }
>

thanks, this seems to make the compiler happy ;-)
I'll contribute a patch to the swtbot project.

I face another similar problem with the swtbot method
ViewMenuFinder.findMenus().
I bet you can provide another hack to retrieve the view's MenuManager in
4.2 to fix
findMenus() which should return the view menus for a given
IViewReferencebut fails
since the non-API method getPane() doesn't exist anymore in 4.2:

public List<SWTBotViewMenu> findMenus(final IViewReference view,
finalMatcher<?> matcher,
final boolean recursive) {

  return UIThreadRunnable.syncExec(new ListResult<SWTBotViewMenu>() {
    public List<SWTBotViewMenu> run() {
      ViewPane viewPane = (ViewPane) ((WorkbenchPartReference)
view).getPane();
      MenuManager mgr = viewPane.getMenuManager();
      List<SWTBotViewMenu> l = new ArrayList<SWTBotViewMenu>();
      l.addAll(getMenuItemsInternal(mgr.getItems(), matcher, recursive));
      return l;
    }
  });
}
-- 
Matthias
_______________________________________________
swtbot-dev mailing list
swtbot-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/swtbot-dev

Reply via email to