Skip to content

Commit 299345e

Browse files
committed
Don't try to remove elements that are not in the tree #3525
Moving an item from one project to another in the Project Explorer, might break the tree structure, resulting in a phantom tree item in the source project. This is because the Project Explorer provides an extension point that allows modifications by external projects (here JDT). When an element is moved, its old position in the tree viewer is removed and its new position added. This removal is done both by the Platform and JDT. But when the element is removed a second time, it no longer exists in the tree and instead a dummy value is created. To reproduce: - Create a new project "Project A" and "Project B" - Create a new text file "test" in "Project A" - Move "test" to "Project B" Closes #3525
1 parent 39d028e commit 299345e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,6 +2062,10 @@ protected void internalRemove(Object[] elementsOrPaths) {
20622062
return;
20632063
}
20642064

2065+
if (findItem(element) == null) {
2066+
continue;
2067+
}
2068+
20652069
boolean continueOuter = false;
20662070
if (getItemsLimit() > 0) {
20672071
Widget[] itemsOfElement = internalFindItems(element);

0 commit comments

Comments
 (0)