The best way to refresh Virtual FIles Follow
Answered
Hi Dears, before I used for refreshing:
Objects.requireNonNull(project.getProjectFile()).refresh(false, true);
now changed to:
VfsUtil.markDirtyAndRefresh(true, true, true, project.getProjectFile());
Please let me know is the second one (of course can be slower then as mentioned in documentation) better or any other solution you can suggest.
Thanks in advance
Please sign in to leave a comment.
Why do you need to refresh this file? From where do you use it?
I am using that in my plugin to refresh in background mode the project when some changes comes from web browser.
This plugin will work to do some background stuff, when I will update something in my account in web some changes in project will see changes in my Intellij project.
So my Intellij project will have installed plugin and also will have configuration file which providing connection configuration to my web project.
ok, but why specifically com.intellij.openapi.project.Project#getProjectFile? what kind of changes?
For example new folder will be added with inside some new file(s).
Did some research and for refresh stuff for project found above mentioned examples.
So I taking the all projects in my plugin and pass to my framework the project.
Project#getProjectFile is not the project directory. You'll probably want to check/refresh content roots of modules inside project, see com.intellij.openapi.roots.ProjectRootManager#getContentRoots
Do you mean refreshing stuff like this :
Thanks for valuable tips.
Yes
Yes