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

Bug 347201

Summary: Selecting "Close Unrelated Projects" leaves some unrelated projects open.
Product: [Eclipse Project] Platform Reporter: bumgarner
Component: IDEAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: bumgarner, prakash
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
An example workspace for verifying the bug none

Description bumgarner CLA 2011-05-25 13:47:51 EDT
Build Identifier: 20100917-0705

When selecting "Close Unrelated Projects" from the package manager, some unrelated projects are left open. Consider three projects A, B, and C where A and B both reference C, but not each other. With all three projects open, selecting "Close Unrelated Projects" on A should close B (and vice versa) but leave C open. Selecting the same option on C should close both A and B. The "Close Unrelated Projects" seems like it should be the reverse of the prompt to  open all referenced projects when a single project is opened.

With A, B, and C open, the "Close Unrelated Projects" option is not available (because it would have no effect?). If an unrelated open project D is added to the workspace, selecting "Close Unrelated Projects" on A will close D, but leave B open. After inspecting the source for CloseUnrelatedProjectsAction, it appears  that it is computing a DisjointSet of the connected components (in this case {{D},{A,B,C}}) and closing all projects not contained in A's set. I think this should be computing the set of projects that are reachable via a directed path starting at A. 

Reproducible: Always

Steps to Reproduce:
1. Setup a workspace with projects A, B, C, D as follows: A references C, B references C, and D is unrelated. 
2. Open all projects A, B, C, D.
3. Right click project A and select "Close Unrelated Projects" and verify that only project D was closed.
Comment 1 bumgarner CLA 2011-05-25 13:53:09 EDT
Created attachment 196583 [details]
An example workspace for verifying the bug

Contains a workspace with A, B, C, and D projects as described in the bug details.
Comment 2 Prakash Rangaraj CLA 2011-05-31 03:32:11 EDT
The action is about closing "related" projects. Not "referenced" projects. If both A and C references B but have no direct references between them, they are still related (though not directly).

This behaviour has been there for years and I don't think we have to change this.