Reputation: 25
I am creating set of eclipse plugins that requires marshalling and unmarshalling of xml.So i have created custom builder to validate these xml which will be executed each time file is changed or deleted.I got my builder to be executed on delete and change event but my problem is that after change or delete file does not exists so i cant unmarshall the file.
In short i want to validate xml in eclipse if its dependent file is changed in any way.So i will be requiring both old and new state of resource.For this i may be requiring some kind of pre-delete or pre-change IFile listeners.
can somebody guide me in right direction???
Thanks.
Upvotes: 0
Views: 596
Reputation: 111142
Use org.eclipse.core.resources.IResourceChangeListener
to listen for all changes to resources in the workspace.
Set up the listener with:
ResourcesPlugin.getWorkspace().addResourceChangeListener(listener);
The listener is given an IResourceChangeEvent
when resources change which contains an IResourceDelta
. The delta may describes changes to several resources.
If IFile
contents are modified using the keep history
flag then the previous file contents can be retrieved using IFile.getHistory
Upvotes: 2