public void resourceChanged ( final IResourceChangeEvent event ) { if ( event . getType ( ) == IResourceChangeEvent . PRE_CLOSE ) { Display . getDefault ( ) . asyncExec ( new Runnable ( ) { public void run ( ) { IWorkbenchPage [ ] pages = getSite ( ) . getWorkbenchWindow ( ) . getPages ( ) ; for ( int i = 0 ; i < pages . length ; i ++ ) { if ( ( ( FileEditorInput ) textEditor . getEditorInput ( ) ) . getFile ( ) . getProject ( ) . equals ( event . getResource ( ) ) ) { IEditorPart editorPart = pages [ i ] . findEditor ( textEditor . getEditorInput ( ) ) ; pages [ i ] . closeEditor ( editorPart , true ) ; } } } } ) ; } }
Closes all project files on project close .