简体   繁体   中英

Eclipse plugin Development : Listener before IFile delete and setcontents?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM