Bug 269844 [GlobalActions] "Close Unrelated Projects" is dangerous and needs confirmation
I20090317-1745 "Close Unrelated Projects" is a dangerous operation with and hence needs a confirmation dialog (with a "don't nag me again" checkbox, if you want). I just inadvertently executed this action from the context menu, and now I have to manually restore my workspace state. Even if Undo would work, that would still cause a full build of all closed projects.
bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CloseUnrelatedProjectsAction.java
/**
 * This action closes all projects that are unrelated to the selected projects. A
 * project is unrelated if it is not directly or transitively referenced by one 
 * of the selected projects, and does not directly or transitively reference
 * one of the selected projects.
 * <p>
 * This class may be instantiated; it is not intended to be subclassed.
 * </p>
 * 
 * @see IDEActionFactory#CLOSE_UNRELATED_PROJECTS
 * @since 3.3
 */
public class CloseUnrelatedProjectsAction extends CloseResourceAction {
	/**
	 * The id of this action.
	 */
	public static final String ID = PlatformUI.PLUGIN_ID + ".CloseUnrelatedProjectsAction"; 
	private final List projectsToClose = new ArrayList();
	private boolean selectionDirty = true;
	private List oldSelection = Collections.EMPTY_LIST;
	
	/**
	 * Builds the connected component set for the input projects.
	 * The result is a DisjointSet where all related projects belong
	 * to the same set.
	 */
	private static DisjointSet buildConnectedComponents(IProject[] projects) {
		
		DisjointSet set = new DisjointSet();
		for (int i = 0; i < projects.length; i++) {