Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » How to maximize the eclipse runtime using SWTBot?(Need Help)
How to maximize the eclipse runtime using SWTBot? [message #947915] Wed, 17 October 2012 11:14 Go to next message
Miguel Pessoa is currently offline Miguel Pessoa
Messages: 22
Registered: May 2012
Location: Brazil
Junior Member
Hello
During the test run using swtbot I would like to maximize the window of an automated eclipse. Does anyone know what code I use to perform this operation?

Thank you.
Re: How to maximize the eclipse runtime using SWTBot? [message #947947 is a reply to message #947915] Wed, 17 October 2012 11:49 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger Herrmann
Messages: 563
Registered: July 2009
Senior Member
Miguel,

as far as I know maximizing a shell isn't supported by SWTBot. You may
want to open an enhancement request. In the meanwhile, you can extend
the SWTBotShell like sketched below.

HTH
Rüdiger

public class SWTBotShellExtension extends SWTBotShell {

public SWTBotShellExtension( Shell shell )
throws WidgetNotFoundException
{
super( shell );
}

public void maximize() {
new SWTBot().waitUntil( new DefaultCondition() {
public String getFailureMessage() {
return "Timed out waiting for "
+ SWTUtils.toString( widget )
+ " to get maximized";
}

public boolean test() throws Exception {
return syncExec( new BoolResult() {
public Boolean run() {
widget.setMaximized( true );
return Boolean.valueOf( widget.getMaximized() );
}
} );
}
} );
notify( SWT.Resize );
}
}


On 17.10.2012 17:14, Miguel Soares Pessoa wrote:
> Hello
> During the test run using swtbot I would like to maximize the window of
> an automated eclipse. Does anyone know what code I use to perform this
> operation?
>
> Thank you.

--
Rüdiger Herrmann
http://codeaffine.com
Re: How to maximize the eclipse runtime using SWTBot? [message #948101 is a reply to message #947947] Wed, 17 October 2012 15:08 Go to previous messageGo to next message
Miguel Pessoa is currently offline Miguel Pessoa
Messages: 22
Registered: May 2012
Location: Brazil
Junior Member
The class constructor receives a Shell, which sheel is that this should be received?
How do I call this method at runtime?
Re: How to maximize the eclipse runtime using SWTBot? [message #948153 is a reply to message #948101] Wed, 17 October 2012 16:13 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger Herrmann
Messages: 563
Registered: July 2009
Senior Member
if you want to maximize the workbench window, then you might obtain the
shell from
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
or whereever your active workbench window is accessible from.
Once you have a reference to the shell that represents the workbench
window,
new SWTBotExtension( shell ).maximize()
will (hopefully) maximize the window.

HTH
Rüdiger

On 17.10.2012 21:08, Miguel Soares Pessoa wrote:
> The class constructor receives a Shell, which sheel is that this should
> be received?
> How do I call this method at runtime?

--
Rüdiger Herrmann
http://codeaffine.com
Re: How to maximize the eclipse runtime using SWTBot? [message #948174 is a reply to message #948153] Wed, 17 October 2012 16:43 Go to previous messageGo to next message
Miguel Pessoa is currently offline Miguel Pessoa
Messages: 22
Registered: May 2012
Location: Brazil
Junior Member
I'm not able to run this way:
Shell shell = new Shell();
		shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
		new SWTBotShellExtension(shell).maximize();

What am I doing wrong?

Thank you for your patience and help.
Re: How to maximize the eclipse runtime using SWTBot? [message #948226 is a reply to message #948174] Wed, 17 October 2012 17:46 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger Herrmann
Messages: 563
Registered: July 2009
Senior Member
Miguel,

obtaining the workbench window from PlaformUI... was just meant as an
example and might not fit your environment - though it commonly works.
What exactly isn't working when you run the code?

HTH
Rüdiger

On 17.10.2012 22:43, Miguel Soares Pessoa wrote:
> I'm not able to run this way:
> Shell shell = new Shell();
> shell =
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
> new SWTBotShellExtension(shell).maximize();
> What am I doing wrong?
>
> Thank you for your patience and help.

--
Rüdiger Herrmann
http://codeaffine.com
Re: How to maximize the eclipse runtime using SWTBot? [message #981278 is a reply to message #948226] Mon, 12 November 2012 04:46 Go to previous message
Mickael Istria is currently offline Mickael Istria
Messages: 745
Registered: July 2009
Location: Grenoble, France
Senior Member
Does your EditPart work correctly on Juno?
I tend to think that SWTBot is doing the right thing, but the EditPart
has a bug with 4.2 that prevents it from being selected.

HTH
--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Previous Topic:controlling the lifecyle of the application test run
Next Topic:activate a tab in the properties view
Goto Forum:
  


Current Time: Fri Aug 29 22:27:46 EDT 2014

Powered by FUDForum. Page generated in 0.12785 seconds