문제

I'm writing an eclipse plugin which contributes to the standard workbench and one action creates a new file under the current project. My problem is though, that the explorer does not refresh when the file is created in the action. What I tried so far:

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

Both are called right after the resource is created. What am I missing? Maybe the resource is not yet merged with the explorer's model? The manual refresh reveals the file...

도움이 되었습니까?

해결책

It depends on how you create the new file. If it is created directly in the filesystem, i.e. without using Eclipse's IResource API, you should refresh the corresponding IResource. For example, as described in refreshLocal(). That should be enough.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top