現在、Eclipse プラグインを開発しています。選択したプロジェクトのコンテキスト メニューを右クリックすると表示される独自のプロパティ ページを作成しました。そのページの [OK] ボタンを押してそのページの値を保存しようとしましたが、「プロジェクト設定の保存中に例外が発生しました: /test/.settings/com.example.plugin.prefs.Resource is out of sync withファイル システム: '/test/.settings/com.example.plugin.prefs' ."
以下は私が実装したものです:
//Get the 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();
}
私の知る限り、"com.example.plugin.prefs" のようなファイルが runtime-EclipseApplication\test.settings にも自動的に保存されるはずですが、それは正しいですか? 誰でもこの問題を解決する方法を知っていますか?