Refreshing the project pane

I am calling out to an external process which creates some files.  How can I have the project pane refresh to display the newly created files?

0

You need to call VirtualFileManager.refresh() to refresh the virtual file system. This will cause the project view and all other parts of the IntelliJ IDEA model to refresh as well.

0
Avatar
Permanently deleted user

Works perfectly.  Here's how I'm using it.

VirtualFileManager.getInstance().asyncRefresh(new Runnable() {
    @Override
    public void run
() {
        String newFilePath = "path/to/file";
        
VirtualFile newFile = LocalFileSystem.getInstance().findFileByPath(newFilePath);
        if
(newFile == null) {
            throw RuntimeException("Could not find newly created file!");
        
} else {
            // Open the file in the editor.
            new
OpenFileDescriptor(project, newFile).navigate(true);
        
}
    }
});
0

请先登录再写评论。