Any change taking place in IResource will invoke the IResource Tracking. It may be caused by mannual operation like adding/remove/rename file by mouse, or eclipse operation like building.
- Register resourceChangedListener
- find IResourceDelta
Each IResourceDelta is tree node, which represents a IResource
- Filter the type (Eclipse Platform Level)
This part of work is proceed in resourceChanged(IResourceChangeEvent event) method which is only method of IResourceChangeListener interface
- Find IResourceDelta event.getDelta() return the root of resourceDelta. Generally, it represents the project where the change takes place.
- Filter the type (Eclipse Platform Level)
-
Traverse resourceDelta(Eclipse project level)
This part of work is prcessed in visit(IResourceDelta delta)method, which is the only method of IResourceDeltaVisitor interface, we can set the return value which is boolean to notify whether the traversaling proceeds. visit will be invoked whenever traversal meets a IResourceDelta. so we need to hander all types of IResource. sometime we are only interested in certain kinds of changes lick content change, we can achieve it by following way In a word, comapred to resourceChanged(IResourceChangeEvent event), visitor focus on the things taking place during the traversal process. Besides that, each traversed node is below the visitor caller which is a IResourceDelta also .