Is there a way to programmatically refresh/synchronize an IntelliJ IDEA project via a plugin?
I'm working on an IntelliJ IDEA plugin that creates a file within the active project. And I want to refresh/synchronize the project automatically via the plugin so that the user can see the changes immediately. Is this possible in IntelliJ IDEA?
After digging a bit more I came through the following solution and it worked.
public void actionPerformed(AnActionEvent e) {
    // Create/Modify files
    // Get the project from the ActionEvent
    Project project = e.getData(PlatformDataKeys.PROJECT);
    // Get the Base Dir and refresh with the following parameters
    // 'asynchronous' set to false and 'recursive' set to true
    project.getBaseDir().refresh(false,true);
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With