Can I have Eclipse close all my projects when I exit?
eclipse, java
Solution
Update 2011:
To actually close all projects on exit, you need a plugin similar to the one mentioned in this thread:
I have implemented `shutdown()` of my plugin to close all the project and save the workspace.
Note: today, you would implement the `stop()` method of an `AbstractUIPlugin`, since `shutdown()` has been deprecated in Eclipse3.0+. In it, you would call `IProject.close()`.
But you also need to set the org.eclipse.ui.IWorkbenchPreferenceConstants.CLOSE_EDITORS_ON_EXIT preference (the one I originally referenced below) for Eclipse to not try to restore those editors when you restart Eclipse again. If you don't, you will get some exceptions like:
Could not restore workbench layout
Unable to restore editor -
createElement returned null for input element factory:
org.eclipse.ui.part.FileEditorInputFactory.
Original answer back in 2010 ;)
This preference is close you need (from this JavaTips) -- it does not close projects, but at least clean your workspace:
> General > Editors > Close editors automatically
When any workspace of the eclipse is closed without closing all its editors and again opens the same workspace, it opens all the editors again which were opened at the time of closing. This might cause slow down the starting of the eclipse. So it is better to close all the opened editors before closing the workspace.
All open editors can be closed automatically with the closing of the eclipse workspace.
Problem
I would like to have Eclipse (3.5, if that matters) close any open projects I have before I exit my workspace. Is this possible? EDIT I forgot to mention that these projects are remotely stored and it would be nice for that reason as well.