Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Open SWT.Shell and make display sleep
Open SWT.Shell and make display sleep [message #1764409] Mon, 29 May 2017 14:05 Go to next message
Marcelo Amoretti is currently offline Marcelo AmorettiFriend
Messages: 1
Registered: April 2017
Junior Member
Hello, everyone.

I have an application which consists on a BasicEntryPoint (Composite) and from this composite I open a SWT.Shell. What I would like to do is make the BasicEntryPoint wait for the user to perform some actions on this new Shell. An example is: The shell is opened and I wait for the user to select some data. After the data is selected, the shell must be closed and the BasicEntryPoint will call some methods to return the selected data inside the shell.

A snippet would be:
Basic Entry Point side:
ExampleShell shell = new Shell();

ExampleShell side:
User selects data and store it into variables;
public long methodA(){
return dataA;}
public String methodB(){
return dataB;}

Basic Entry Point side:
long number = shell.methodA();
String string = shell.methodB();

The main issue found here is that the display doesn't sleep while I'm using this shell. Basically the main code keeps running and all I get from the shell are null pointers. Any thoughts here?

[Updated on: Wed, 31 May 2017 13:42]

Report message to a moderator

Re: Open SWT.Shell and make display sleep [message #1764628 is a reply to message #1764409] Wed, 31 May 2017 23:11 Go to previous message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 205
Registered: February 2011
Senior Member
You've got two options here:
1) Add a listener to the shell that calls your code that needs to run when the shell closes. That's how it's done in org.eclipse.swt.widgets.Dialog.open(DialogCallback)
2) Have your shell block the caller by running the event loop in its open method. That's the came concept used in org.eclipse.jface.window.Window.open()

Option 1 has the benefit that it will work when RWT is running in JEE_COMPATIBILITY, where as Option 2 will only work in SWT_COMPATIBILITY mode. (see org.eclipse.rap.rwt.application.Application.OperationMode)
Previous Topic:Download file
Next Topic:How to set BusinessTheme programatically?
Goto Forum:
  


Current Time: Thu Aug 16 11:52:09 GMT 2018

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

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

Back to the top