Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Cannot catch IResourceChangeEvent.PRE_DELETION in TextEditor
Cannot catch IResourceChangeEvent.PRE_DELETION in TextEditor [message #504921] Wed, 23 December 2009 04:49 Go to next message
Neopux Missing name is currently offline Neopux Missing name
Messages: 9
Registered: December 2009
Junior Member

If my text editor has unsaved changing it does not close on underlying resource deletion.I try to extend my TextEditor from IResourceChangeListener and add it to workspace but it trows only IResourceChangeEvent.CHANGED (not IResourceChangeEvent.PRE_DELETE)on resource deletion.
Anyone have the same problem? Plz, help me


With the best regards,
Irn.
Re: Cannot catch IResourceChangeEvent.PRE_DELETION in TextEditor [message #505294 is a reply to message #504921] Tue, 29 December 2009 01:09 Go to previous message
Neopux Missing name is currently offline Neopux Missing name
Messages: 9
Registered: December 2009
Junior Member

I found interesting article about this:
http://www.eclipse.org/articles/Article-Resource-deltas/reso urce-deltas.html
so I solved the problem in the following way:

pyblic myEditor implements IResourceChangeListener {
.....
@Override
public void resourceChanged(IResourceChangeEvent event)
{
IResourceDelta rootDelta = event.getDelta();
IFile resource = (IFile) getEditorInput().getAdapter(IResource.class);
IResourceDelta delta = rootDelta.findMember(resource.getFullPath());
if (delta != null && delta.getKind() == IResourceDelta.REMOVED)
{
close(false); //this method closes editor Smile
}
}
}


With the best regards,
Irn.
Previous Topic:How to organize a complex build
Next Topic:Cannot catch IResourceChangeEvent.PRE_DELETION in TextEditor
Goto Forum:
  


Current Time: Wed Jul 23 22:10:23 EDT 2014

Powered by FUDForum. Page generated in 0.04085 seconds