pop-up shell closing [message #467739] |
Sun, 05 February 2006 11:08  |
Eclipse User |
|
|
|
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 #467753 is a reply to message #467743] |
Mon, 06 February 2006 01:35  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.06677 seconds