I wrote the code such that pressing the X button on the upper right corner will pop up a message that allows you to cancel exiting the window(using DisposeListener). the problem is that the X button automatically (so i believe) performs shell.dispose() and pressing "Cancel" closes the window anyways, even though the code does not say dispose() upon cancelling.

How do I prevent the X button from disposing of my window when "Cancel" is pressed?