I'm using SWTBot to test my Eclipse RCP application. Most things worked
well when I moved some initialization code from the interactive splash
screen handler to the ApplicationWorkbenchAdvisor.
Only remaining issue I see is using SWTBot to test an Eclipse plug-in that
has an embedded Swing component. I'm using the SWT_AWT.new_Frame and when
I call the bot.views() method it returns an exception when I try to
retrieve the control for the plug-in that contains the embedded SWT_AWT
frame. It seems the call to getControl() returns NULL.
The code I'm using in the createPartControl for the plug-in is...
public void createPartControl(Composite parent)
{
Composite comp = new Composite(parent,SWT.EMBEDDED | SWT.NO_BACKGROUND);
Frame frame = SWT_AWT.new_Frame(comp);
Richard Koop wrote:
> I'm using SWTBot to test my Eclipse RCP application. Most things worked
> well when I moved some initialization code from the interactive splash
> screen handler to the ApplicationWorkbenchAdvisor.
SWTBot is not activated at the splash handler so you won't be able to
automate anything at that level.
> Only remaining issue I see is using SWTBot to test an Eclipse plug-in
> that has an embedded Swing component. I'm using the SWT_AWT.new_Frame
> and when I call the bot.views() method it returns an exception when I
> try to retrieve the control for the plug-in that contains the embedded
> SWT_AWT frame. It seems the call to getControl() returns NULL.
>
> The code I'm using in the createPartControl for the plug-in is...
>
> public void createPartControl(Composite parent)
> {
> Composite comp = new Composite(parent,SWT.EMBEDDED | SWT.NO_BACKGROUND);
> Frame frame = SWT_AWT.new_Frame(comp);
>
> ...
> }
The code in theory looks fine. I assume that getControl should have
returned the composite that you created. But I'll need to try this out
before I make any comments :)
Could you just try a creating another composite to see what happens ?