Java Eclipse plugin Development - Save all project

2020-07-22 04:42发布

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.

2条回答
趁早两清
2楼-- · 2020-07-22 04:57

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.

查看更多
我想做一个坏孩纸
3楼-- · 2020-07-22 05:04

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();
       }
}
查看更多
登录 后发表回答