3

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.

Community
  • 1
  • 1
Tomerico
  • 63
  • 5
  • Maybe the sources of that plugin (http://stackoverflow.com/questions/1142547/eclipse-autosave-plugin/1142568#1142568) might help? Combined with http://stackoverflow.com/questions/2157016/how-do-i-stop-an-eclipse-editor-from-closing-in-an-rcp/2157673#2157673 – VonC May 24 '10 at 13:37

2 Answers2

5

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
  • 1,463
  • 10
  • 20
0

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
  • 63
  • 5