Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » pop-up shell closing
pop-up shell closing [message #467739] Sun, 05 February 2006 16:08 Go to next message
Dominique Buenzli is currently offline Dominique BuenzliFriend
Messages: 59
Registered: July 2009
Member
Hello,
I have a rcp application in which there is a button. When you click on
this button, it brings up a shell containing other things. The problem
is that when I close this shell, the all application is closing.
- Here is the code of my button calling the shell:

buttonnouvelleconsultation.addMouseListener(new
org.eclipse.swt.events.MouseAdapter() {

public void mouseDown(org.eclipse.swt.events.MouseEvent e) {

; // TODO Auto-generated Event stub mouseDown()

Medclipse_Consultation_Consultation_PopUp_Consulte.main (null);

}

});

- Here is the main code of my pop-up shell:

public static void main(String[] args) {
Display display = Display.getDefault();
Medclipse_Consultation_Consultation_PopUp_Consulte thisClass = new
Medclipse_Consultation_Consultation_PopUp_Consulte();
thisClass.createSShell();
thisClass.sShell.open();

while (!thisClass.sShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
/**
* This method initializes sShell
*
*/
private void createSShell() {
sShell = new Shell();
sShell.setLayout(new FillLayout()); // Generated
sShell.setText("CONSULTATION"); // Generated
sShell.setSize(new Point(743, 524)); // Generated
createScrolledComposite();

sShell.setSize(new Point(743, 407)); // Generated
}
Re: pop-up shell closing [message #467742 is a reply to message #467739] Sun, 05 February 2006 16:10 Go to previous messageGo to next message
Dominique Buenzli is currently offline Dominique BuenzliFriend
Messages: 59
Registered: July 2009
Member
And the question is: how to do so that when I close the pop-up shell,
the main application is not closing with. Thanks.
Re: pop-up shell closing [message #467743 is a reply to message #467742] Sun, 05 February 2006 17:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

If you are popping up a shell from within an already running display
thread you shouldn't be calling main and creating a new display. You
should instead simply bring up your popup. You disposed the display in
the popup's main. But that is the same display that the rest of your
application is using, so naturally that shut them down too.

All you need to do is:

Medclipse_Consultation_Consultation_PopUp_Consulte thisClass =
new Medclipse_Consultation_Consultation_PopUp_Consulte();
thisClass.createSShell();
thisClass.sShell.open();

PS: You should make the shell you create be modal to your application
too so that your application is disabled until your popup is complete.
I'm assuming that is what you want to do. In that case you need to
create your shell with:

new Shell(applicationParentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);

this will make it look like a popup dialog and your application won't
continue until it has been closed.



Dominique Buenzli wrote:
> And the question is: how to do so that when I close the pop-up shell,
> the main application is not closing with. Thanks.
>

--
Thanks,
Rich Kulp
Re: pop-up shell closing [message #467753 is a reply to message #467743] Mon, 06 February 2006 06:35 Go to previous message
Dominique Buenzli is currently offline Dominique BuenzliFriend
Messages: 59
Registered: July 2009
Member
This worked perfectly well thank you for your help.

Dominique

On 2006-02-05 18:03:49 +0100, Rich Kulp <richkulp@us.NO_SPAM.ibm.com> said:

> If you are popping up a shell from within an already running display
> thread you shouldn't be calling main and creating a new display. You
> should instead simply bring up your popup. You disposed the display in
> the popup's main. But that is the same display that the rest of your
> application is using, so naturally that shut them down too.
>
> All you need to do is:
>
> Medclipse_Consultation_Consultation_PopUp_Consulte thisClass =
> new Medclipse_Consultation_Consultation_PopUp_Consulte();
> thisClass.createSShell();
> thisClass.sShell.open();
>
> PS: You should make the shell you create be modal to your application
> too so that your application is disabled until your popup is complete.
> I'm assuming that is what you want to do. In that case you need to
> create your shell with:
>
> new Shell(applicationParentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
>
> this will make it look like a popup dialog and your application won't
> continue until it has been closed.
>
>
>
> Dominique Buenzli wrote:
>> And the question is: how to do so that when I close the pop-up shell,
>> the main application is not closing with. Thanks.
Previous Topic:Check box in Table viewer
Next Topic:Can ComparePlugin be used in SWT stand-a-lone application
Goto Forum:
  


Current Time: Fri Apr 19 12:16:13 GMT 2024

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

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

Back to the top