How to force refresh config file(xml file) of PersistentStateComponent
已回答
@State(name = "xxx", storages = {@Storage("xxx.xml")})
public class XxxComponent implements PersistentStateComponent<CollectionConfiguration> {
}
when some operation change the XxxComponent, the config file xxx.xml will not change immediately, but when on frame deactivation it will be refreshed,

But i want to get the newest xml content of xxx.xml when XxxComponent changed.
I have try the follow code, but it do not work
VirtualFile xmlVirtualFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(path);
xmlVirtualFile.refresh(false, false);
So is there any way to force refresh xxx.xml or trigger the refresh operation of PersistentStateComponent
请先登录再写评论。
Hi Wilson,
There is no open API to force saving PersistentStateComponent. Why do you need that?
Thanks for your reply Karol!
XML file persistence will sometimes delay after PersistentStateComponent has changed.
Finally i have find the solution, Use scheduleProjectSave can force saving PersistentStateComponent xml file,
and then use Timer to get the last content from xml config file