We take pride in your success. We let our positivity drive us, day in and out. Talk to us at Mindfire to know us more.

Software Technology Tips

Sometimes it's very necessary to notify/show confirmation the user before exiting the whole application.

 So, for displaying the confirmation in RCP application we need to either override

 
boolean org.eclipse.ui.application.WorkbenchWindowAdvisor.preWindowShellClose()
 
OR
 
boolean org.eclipse.ui.application.WorkbenchAdvisor.preShutdown()
 
The return value of the above functions determines wheather to close the application or not, which is in default true.
Example:
 
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
    .....................
    .....................
   
    @Override
    public boolean preWindowShellClose() {
        boolean result = false;
        // custom dialog code goes here.
        // And the variable result is updated by the choice of the dialog.
        return result;
    }
    ..................
    ..................
}


Related Tags:

Eclipse, Java

Author: Debabrata Pati

top

Java

Let us Connect!

privacy

copyright (c) Mindfire Solutions 2007-2012. Login