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?

Comment actions Permalink

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.

Comment actions Permalink

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

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

Please sign in to leave a comment.