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 #603853] Wed, 23 December 2009 09:49 Go to next message
Neopux Missing name is currently offline Neopux Missing nameFriend
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
Re: Cannot catch IResourceChangeEvent.PRE_DELETION in TextEditor [message #603874 is a reply to message #603853] Tue, 29 December 2009 06:09 Go to previous message
Neopux Missing name is currently offline Neopux Missing nameFriend
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 :)
}
}
}
Previous Topic:Problem with Dandelion - Lisp development plugin for eclipse
Next Topic:Update Site Project, Source inclusion
Goto Forum:
  


Current Time: Mon Mar 27 08:43:53 GMT 2017

Powered by FUDForum. Page generated in 0.01911 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software