diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceTreeAndListGroup.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceTreeAndListGroup.java index 8a6fae213b8..74adfe8495d 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceTreeAndListGroup.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceTreeAndListGroup.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; import org.eclipse.core.commands.common.EventManager; @@ -73,6 +74,15 @@ public void checkStateChanged(final CheckStateChangedEvent event) { BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), () -> { if (event.getCheckable().equals(treeViewer)) { + /* + * On Windows, checking an item does not automatically update the tree selection + * like on Linux environment. Force the checked element to become the current + * selection so SelectionListener and CheckListener stay in sync together + */ + Object currentSelection = treeViewer.getStructuredSelection().getFirstElement(); + if (!Objects.equals(currentSelection, event.getElement())) { + treeViewer.setSelection(new StructuredSelection(event.getElement()), true); + } treeItemChecked(event.getElement(), event .getChecked()); } else {