Refreshing project view.
Hi,
I am creating a plugin for a version control system for IntelliJ 6.0.5. I have a workspace, there are some incoming changes. These changes may involve removing/adding of file/folder. After successful execution of the update, these changes are not reflected in the project view. If I switch view, they appear in the view.
I used -
ProjectView.getInstance(project).refresh();
]]>
This does not work.
Any help please.
Thanks
Devang Shah
Please sign in to leave a comment.
In some of the sample vcs plugins some code like the following is used:
private void refreshAll() {
for (VirtualFile file : files) {
file.refresh(true, true);
}
}
private void refreshAfter() {
Runnable refreshAction = new Runnable() {
public void run() {
refreshAll();
}
};
if (ApplicationManager.getApplication().isDispatchThread()) {
refreshAction.run();
} else {
ApplicationManager.getApplication().invokeLater(refreshAction);
}
}
n.b. where files in the first method is a class field
n.b. this was code at the time of IDEA 6
See also VirtualFileSystem.refresh() or VirtualFileManager.refresh()
HTH,
Ruben
Hi,
Thanks, using VirtualManager.refresh() worked.
Couple of more questions.
Would this affect the performance of the plugin, because on the plugin performs an extra task of rendering icons on the files.
Could I have update specific to a file/folder?
After performing VirtualManager.refresh(), do I have to call ProjectView.refresh() ?
Thanks,
Devang Shah
>performance
If you use constructions like ApplicationManager.getApplication().invokeLater(refreshAction);
Then the responsiveness of your application is likely to stay as is.
>Could I have update specific to a file/folder?
yep, file.refresh(true, true);
>After performing VirtualManager.refresh(), do I have to call ProjectView.refresh() ?
nope (AFAIK)