Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Eclipse RCP-以编程方式刷新PackageExplorerPart_Java_Eclipse Plugin_Rcp_Treeviewer - Fatal编程技术网

Java Eclipse RCP-以编程方式刷新PackageExplorerPart

Java Eclipse RCP-以编程方式刷新PackageExplorerPart,java,eclipse-plugin,rcp,treeviewer,Java,Eclipse Plugin,Rcp,Treeviewer,我正在编写一个eclipse插件,它为标准工作台做出贡献,一个操作将在当前项目下创建一个新文件。但我的问题是,在操作中创建文件时,资源管理器不会刷新。到目前为止,我尝试的是: ((PackageExplorerPart)part).refresh(treeSelection); //where the selection is the root project ((PackageExplorerPart)part).getTreeViewer().refresh; 这两个函数都是在创建资源后立

我正在编写一个eclipse插件,它为标准工作台做出贡献,一个操作将在当前项目下创建一个新文件。但我的问题是,在操作中创建文件时,资源管理器不会刷新。到目前为止,我尝试的是:

((PackageExplorerPart)part).refresh(treeSelection); //where the selection is the root project
((PackageExplorerPart)part).getTreeViewer().refresh;

这两个函数都是在创建资源后立即调用的。我错过了什么?可能资源尚未与资源管理器的模型合并?手动刷新显示文件…

这取决于您如何创建新文件。如果直接在文件系统中创建,即不使用Eclipse的IResource API,则应刷新相应的IResource。例如,如中所述。这应该足够了。

这取决于您如何创建新文件。如果直接在文件系统中创建,即不使用Eclipse的IResource API,则应刷新相应的IResource。例如,如中所述。这应该足够了。

感谢它的帮助,尽管我必须先用
ResourcesPlugin.getWorkspace().getRoot().getFile(…)
找到文件,因为创建的方法没有返回它。感谢它的帮助,尽管我必须先用
ResourcesPlugin.getWorkspace().getRoot().getFile(…)找到文件
,因为创建的方法没有返回它。