Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 258456

Summary: Deleting projects causes editor error instead of close
Product: [Eclipse Project] Platform Reporter: Paul Webster <pwebster>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, markus.kell.r
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Error in the error log none

Description Paul Webster CLA 2008-12-11 10:16:14 EST
Created attachment 120205 [details]
Error in the error log

I had about 8 projects in my workspace, and a couple of java editors open.

I selected all the projects and did a delete (delete content on disk).

The Java editor replaced its content with "Error" content, i.e. the file is not found. and none of the editors closed.

PW
Comment 1 Markus Keller CLA 2008-12-12 10:50:09 EST
I can reproduce with I20081211-1908, but only when I
- open multiple editors from a project (stacked)
- restart the workbench (only top-most editor is materialized)
- delete the project (including content on disk)

Similar scenario on startup when an editor's file has gone: Bug 180452.

Paul, does the workbench have a story for how editors should behave when their input is not valid? We currently throw a PartInitException in AbstractTextEditor.internalInit(..), and EditorReference.createPart() line: 463	writes it to the log.

For fully created editors, we just close them when the file buffer gets deleted, but for not-yet restored editors, I don't see a hook for us to do this.

My favorite solution would be that the workbench uses IEditorInput.exists() to check if the input of the editor to be restored still exists. If it doesn't, just close the editor, or open an error editor that tells what really happened, instead of writing an exception to the log and to the Details>> area in the editor.
Comment 2 Paul Webster CLA 2008-12-12 11:25:56 EST
(In reply to comment #1)
> For fully created editors, we just close them when the file buffer gets
> deleted, but for not-yet restored editors, I don't see a hook for us to do
> this.

This might be a Platform UI problem then.  I don't think we handle that gracefully (and the client code has not yet been instantiated, so it's not their problem).

PW
Comment 3 Dani Megert CLA 2008-12-13 06:32:34 EST

*** This bug has been marked as a duplicate of bug 186977 ***