Skip to main content



      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 10:05 Go to next message
Eclipse UserFriend
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 09:42] by Moderator

Re: Open SWT.Shell and make display sleep [message #1764628 is a reply to message #1764409] Wed, 31 May 2017 19:11 Go to previous message
Eclipse UserFriend
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: Sun Jul 13 13:22:01 EDT 2025

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

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

Back to the top