java – 通过插件以编程方式刷新/同步IntelliJ IDEA项目

前端之家收集整理的这篇文章主要介绍了java – 通过插件以编程方式刷新/同步IntelliJ IDEA项目前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
有没有办法通过插件以编程方式刷新/同步IntelliJ IDEA项目?

我正在开发一个IntelliJ IDEA插件,可以在活动项目中创建一个文件.我想通过插件自动刷新/同步项目,以便用户可以立即看到更改.这在IntelliJ IDEA中是否可行?

解决方法

经过多次挖掘后,我得到了以下解决方案,并且有效.

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);

}

猜你在找的IDEA相关文章