Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/org.eclipse.jface/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jface;singleton:=true
Bundle-Version: 3.38.100.qualifier
Bundle-Version: 3.38.200.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jface,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2019 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -2095,12 +2095,7 @@ protected void internalRemove(Object[] elementsOrPaths) {
Object parent = getParentElement(element);
if (parent != null && !equals(parent, getRoot())
&& !(parent instanceof TreePath tp && tp.getSegmentCount() == 0)) {
Widget[] parentItems = internalFindItems(parent);
for (Widget parentItem : parentItems) {
if (parentItem instanceof Item it) {
updatePlus(it, parent);
}
}
internalRemove(parent, new Object[] { element });
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.jface.tests
Bundle-Version: 1.4.1100.qualifier
Bundle-Version: 1.4.1200.qualifier
Automatic-Module-Name: org.eclipse.jface.tests
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.junit;bundle-version="4.12.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -14,7 +14,10 @@
package org.eclipse.jface.tests.viewers;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -114,4 +117,43 @@ protected void internalExpandToLevel(Widget widget, int level) {
}
}

/**
* Removing the same element twice should not produce a dummy tree-item.
*/
@Test
public void testIssue3525() {
TestElement modelRoot = TestElement.createModel(2, 1);
TestElement modelParent = modelRoot.getChildAt(0);
TestElement modelChild = modelParent.getChildAt(0);
fTreeViewer.setInput(modelRoot);
fTreeViewer.expandAll();

TreeItem widgetParent = (TreeItem) fTreeViewer.testFindItem(modelParent);
TreeItem widgetChild = (TreeItem) fTreeViewer.testFindItem(modelChild);
assertNotNull(widgetParent);
assertNotNull(widgetChild);
assertArrayEquals(widgetParent.getItems(), new TreeItem[] { widgetChild });

// This workaround is needed because of TreeViewerWithLimitCompatibilityTest
// When calling setDisplayIncrementally(...) with a positive number, you are
// no longer able to remove elements from the viewer without first removing
// them from the model
modelParent.fChildren.remove(modelChild);
fTreeViewer.remove(modelChild);
modelParent.fChildren.add(modelChild);

widgetParent = (TreeItem) fTreeViewer.testFindItem(modelParent);
widgetChild = (TreeItem) fTreeViewer.testFindItem(modelChild);
assertNotNull(widgetParent);
assertNull(widgetChild);
assertArrayEquals(widgetParent.getItems(), new TreeItem[0]);

fTreeViewer.remove(modelChild);

widgetParent = (TreeItem) fTreeViewer.testFindItem(modelParent);
widgetChild = (TreeItem) fTreeViewer.testFindItem(modelChild);
assertNotNull(widgetParent);
assertNull(widgetChild);
assertArrayEquals(widgetParent.getItems(), new TreeItem[0]);
}
}
Loading