Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Swing support
Swing support [message #32851] Mon, 20 April 2009 15:05 Go to next message
Richard Koop is currently offline Richard Koop
Messages: 15
Registered: July 2009
Junior Member
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);

...
}

Does this code need to be restructured?

Richard
Re: Swing support [message #32998 is a reply to message #32851] Wed, 22 April 2009 04:55 Go to previous message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
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 ?

-- Ketan
Previous Topic:java.lang.NoSuchMethodError while running SWTBot on Mac OS
Next Topic:Problem with opening File Menu
Goto Forum:
  


Current Time: Fri Aug 29 18:39:37 EDT 2014

Powered by FUDForum. Page generated in 0.01511 seconds