Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Swing support
Swing support [message #32851] Mon, 20 April 2009 19:05 Go to next message
Richard Koop is currently offline Richard KoopFriend
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 08:55 Go to previous message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
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: Sat Apr 27 01:19:58 GMT 2024

Powered by FUDForum. Page generated in 0.03161 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top