Question

We have developed an Eclipse RCP Applicatoin. We have a requirement to check for all the dirty editors and prompt the user to save the same before we launch our dialog.

Please let me know if we have any reusable dialog to achieve the same.

Thanks in Advance, Harish

Was it helpful?

Solution 2

Use org.eclipse.ui.ide.IDE.saveAllEditors:

IResource [] resources = array of IFile, IFolder, IProject 

boolean ok = IDE.saveAllEditors(resources, confirm);

From the JavaDoc:

Save all dirty editors in the workbench whose editor input is a child resource of one of the IResource's provided. Opens a dialog to prompt the user if confirm is true. Return true if successful. Return false if the user has canceled the command.

OTHER TIPS

PlatformUI.getWorkbench().saveAllEditors(confirm);

Saves all dirty editors in the workbench. Opens a dialog to prompt the user if confirm is true

Source: http://www.eclipse.org/forums/index.php/t/95433/ and javadoc

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top