简体   繁体   中英

how to close MessageBox in RCP plugin development?

I have created a MessageBox while developing Eclipse plugin which opens when you perform some action...however even after i say "OK" on that messageBox the dialog MessageBox occurs again and again..

Can anyone tell me how to close MessageBox once it is shown to user..

To open dialog box i wrote following code: MessageBox dialog = new MessageBox(new Shell(), SWT.OK); dialog.setMessage("Some message"); dialog.setText("Title"); dialog.open();

Your Problem has nothing to do with the code you posted. Please provide us with additional information. Also consider to set the shell of the currently active widget as parent shell in the MessageBox constructor (eg new MessageBox(swtControl.getShell(), SWT.OK) . Otherwise the dialog might not be modal. This depends on the modal style of the Shell .

After research i found that you need to dispose component that you need no longer once specific action has been completed. So once my MessageDialog appears and user clicks OK... i need to dispose my MessageDialog using Display.getCurrent().dispose()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM