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


With the best regards,
Irn.
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 :)
}
}
}


With the best regards,
Irn.
Previous Topic:Cannot catch IResourceChangeEvent.PRE_DELETION in TextEditor
Next Topic:Re: Workspaces, Eclipse Versions, and Plugins
Goto Forum:
  


Current Time: Mon Dec 22 15:08:39 GMT 2014

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

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