Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343796 - SWTBotEclipseEditor#invokeAction throws ClassCastException
Summary: SWTBotEclipseEditor#invokeAction throws ClassCastException
Status: NEW
Alias: None
Product: SWTBot
Classification: Technology
Component: EclipseBot (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-26 01:44 EDT by Radhakrishna Bhat CLA
Modified: 2014-06-23 05:40 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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?