【发布时间】:2019-01-11 20:03:54
【问题描述】:
我使用以下代码制作了一个无头 Eclipse 插件:
public class Application implements IApplication {
@Override
public Object start(IApplicationContext context) throws Exception {
System.out.println("ok this is it!");
IPreferencesService service = Platform.getPreferencesService();
try {
FileOutputStream fout = new FileOutputStream(new File("c:/temp/ohno.epf"));
service.exportPreferences(service.getRootNode(), fout, null);
}catch(Exception e)
{
}
return null;
}
为什么会这样
service.exportPreferences(service.getRootNode(), fout, null);
写一个空文件?我所期待的行为与通过 File->Export [Preferences] 菜单导出 Preferences 相同。一定是 service.getRootNode 没有返回我所期望的,这是所有偏好的根源。
如何获得所有偏好?不仅是工作区首选项或默认选项,还有全部?
【问题讨论】:
-
有趣的项目。似乎您缺少
scope的首选项,如in the official docs 所述。此外,this question 试图做类似的事情。如果您分享您的项目,我愿意合作。 -
Here 更多相关信息。