开发者

Eclipse plugin project preference saving exception

I am currently developing an eclipse plugin, i created my own property page which will be displayed when right-clicking on the context menu of selected project. I tried to save values of that page by pressing OK button on that page, but i got exception saying: "Exception occurred while saving project preferences: /test/.settings/com.example.plugin.prefs.Resource is out of sync with the file system: '/test/.settings/com.example.plugin.prefs'."

Following is what i implemented:

//Get t开发者_开发问答he project
IAdaptable resource = getElement();
if (resource != null) {
   IProject project = (IProject) resource.getAdapter(IProject.class);
}    
//Define project scope
IScopeContext projectScope = new ProjectScope(project);
//Get node by qualified name
Preferences projectNode = projectScope.getNode(MyPlugin.PLUGIN_ID);
//set the value and save it
if (projectNode != null) {
projectNode.put(PROPERTIES_SERVICENAME, serviceName);
}       
try {
projectNode.flush();  // Exception occurs here!!!
} catch (BackingStoreException e) {
e.printStackTrace();
}

To my knowledge, it should automatically save a file like "com.example.plugin.prefs" under runtime-EclipseApplication\test.settings as well, is that correct? Anybody has idea how to solve this problem?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜