views:

66

answers:

2

I'm developing a plugin for Eclipse. I'd like it to suggest the user to save unsaved resources before running. This is in a similar behavior to how eclipse suggest you to save unsaved files before debugging.

In essence, I would like to open the following dialog:

alt text

Any help will be greatly appreciate.

+1  A: 

If you hit alt-shift-F1 on that dialog, you will see which plugin it is in, and then you could either trigger that action, or call that code directly.

dplass
Thanks, that is a fantastic tip!
Tomerico
A: 

Using dplass's tip I reached this solution, which works perfectly. I'm putting it here for other people who might encounter this problem:

import org.eclipse.core.resources.IProject;

@SuppressWarnings("restriction")
public class SaveOpenFilesHandler extends org.eclipse.debug.internal.ui.launchConfigurations.SaveScopeResourcesHandler
{   
       public void showSaveDialog(IProject project)
       {
           super.showSaveDialog(new IProject[] {project}, true, true);
           super.doSave();
       }
}
Tomerico