| Summary: | SWTBotWorkbenchPart cannot find toolbar buttons for editor | ||
|---|---|---|---|
| Product: | [Technology] SWTBot | Reporter: | Tim Moore <tmm-bugs.eclipse> |
| Component: | SWTBot | Assignee: | Project Inbox <swtbot-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Build Identifier: M20100909-0800 SWTBotWorkbenchPart.getToolbarButtons() has the following code: --- PartPane obj = ((WorkbenchPartReference) partReference).getPane(); ToolBar toolbar = (ToolBar) obj.getToolBar(); --- But the implementation of getToolbar for EditorPane is: --- public Control getToolBar() { return null; } --- So obviously that can never find any. Something like this in SWTBotWorkbenchPart.getToolbarButtons() allows Editor toolbars to be accessed as well: --- final IToolBarManager toolbarMgr; if (partReference instanceof IEditorReference) { toolbarMgr = ((IEditorReference) partReference).getEditor(false).getEditorSite().getActionBars().getToolBarManager(); } else { toolbarMgr = ((IViewReference) partReference).getView(false).getViewSite().getActionBars().getToolBarManager(); } final ToolItem[] items = ((ToolBarManager) toolbarMgr).getControl().getItems(); --- No doubt there is a more succinct solution, but this does at least appear to work. Reproducible: Always