Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Closing editors when project is closed/deleted
Closing editors when project is closed/deleted [message #570384] Tue, 21 September 2010 16:47
Subhash Gopalakrishnan is currently offline Subhash GopalakrishnanFriend
Messages: 5
Registered: July 2009
Junior Member
I have frequently come across the scenario where a project is closed or
deleted and the editors that are opened on the contained files don't
close automatically, but remain open and complain about missing files.

While debugging my editors, I realized that some editors subscribe to
resource change events and close with the project. But when a workbench
with open editors restarts, some of the editors might not be initialized
and therefore not subscribed to resource change events. This causes the
aforementioned error to occur when editors haven't yet got focus.

Is it a valid solution to instead keep a singleton listener in my plugin
activator and subscribe it during start() and unsubscribe during stop()?
This listener gets the active workbench page, gets all the editor
references, checks if their input matches the event's resource and if
so, close the editor.

I tried out this solution and it seems to work fine for project closes,
project deletes, file deletes across workbench restarts. And then, I was
curious to know if this is the usual way this problem is handled and if
I am missing something. Please let me know if there's a specific reason
for subscribing a listener for each editor.

Previous Topic:Zoom in view?
Next Topic:Need Link example???
Goto Forum:

Current Time: Mon Jan 25 18:12:12 GMT 2021

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

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

Back to the top