Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343796

Summary: SWTBotEclipseEditor#invokeAction throws ClassCastException
Product: [Technology] SWTBot Reporter: Radhakrishna Bhat <radhakrishna12>
Component: EclipseBotAssignee: Project Inbox <swtbot-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: KetanPadegaonkar, mistria, radhakrishna12
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Radhakrishna Bhat CLA 2011-04-26 01:44:11 EDT
Build Identifier: 3.6.1 with latest swtbot from update site

SWTBotEclipseEditor provides neat ways of invoking Quick Assists and Auto completion. This works well for normal editors implementing ITextEditor. But it fails when the editor is instance 'MultiPageEditor' with 2 or more ITextEditors in it.
 

Reproducible: Always

Steps to Reproduce:
1. Using SWTBot open an editor which extends MultipageEditor
2. Get the SWTBotEcliseEditor and execute editor.getQuickFixes();
3. No output
4. Because of ClassCastException in SWTBotEclipseEditor#invokeAction (Since my editor is MultiPageEditor).

Suggested solution(May be:) Can you make invokeAction method's access specifier to 'protected' so that I can extend and override and cast it to proper editor?
 type.
Comment 1 Ketan Padegaonkar CLA 2011-04-26 02:06:50 EDT
Could you please provide a stacktrace that points to the problem?
Comment 2 Radhakrishna Bhat CLA 2011-04-26 02:39:40 EDT
There is no stacktrace. The exception gets caught in quickFixAppears method.

The problem is in the line -->

"final IAction action = ((ITextEditor) partReference.getEditor(false)).getAction(actionId);" in invokeAction method of SWTBotEclipseEditor. 

partReference.getEditor(false) returns an instance of MultiPageEditor in my application which cannot be casted to ITextEditor. (ClassCastException when i debugged to that line)


(In reply to comment #1)
> Could you please provide a stacktrace that points to the problem?