Track files changes done by eclipse cleanup programmatically

孤人 提交于 2019-12-06 15:06:26

There are multiple levels of object in the IResourceChangeEvent at the top is usually the project or the workspace and below that are folders and files. These are represented by IResourceDelta objects.

To see all of them first get the top level IResourceDelta from the event:

IResourceChangeEvent event = ... the event

IResourceDelta delta = event.getDelta();

and then use an IResourceDeltaVisitor to visit each resource in the delta:

delta.accept(visitor);

where visitor is a class implementing IResourceDeltaVisitor.

There is just one method in the visitor:

public boolean visit(IResourceDelta delta) throws CoreException

which is given a delta for each resource.

IResourceDelta.getResource gives you the changed resource. IResourceDelta.getKind tells you the type of change (add, delete, change).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!