Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -879,12 +879,24 @@ public void refresh() {
lastRefreshSelection = prepareInitialSelection(lastRefreshSelection);
}
// preserve previous selection
if (refreshWithLastSelection && lastRefreshSelection != null && lastRefreshSelection.size() > 0) {
tableViewer.setSelection(new StructuredSelection(lastRefreshSelection));
// Apply selection asynchronously to ensure table refresh has completed
// This fixes race condition where setSelection() is called before
// tableViewer.refresh() has fully updated the table items
final List<Object> selectionToApply = lastRefreshSelection;
if (refreshWithLastSelection && selectionToApply != null && selectionToApply.size() > 0) {
tableViewer.getTable().getDisplay().asyncExec(() -> {
if (!tableViewer.getTable().isDisposed()) {
tableViewer.setSelection(new StructuredSelection(selectionToApply));
}
});
} else {
refreshWithLastSelection = true;
tableViewer.getTable().setSelection(0);
tableViewer.getTable().notifyListeners(SWT.Selection, new Event());
tableViewer.getTable().getDisplay().asyncExec(() -> {
if (!tableViewer.getTable().isDisposed()) {
tableViewer.getTable().setSelection(0);
tableViewer.getTable().notifyListeners(SWT.Selection, new Event());
}
});
}
} else {
tableViewer.setSelection(StructuredSelection.EMPTY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,8 @@ private void waitForDialogRefresh() {
});

// Then wait additional time for selection to be applied
// The selection is set asynchronously after table population completes
// Previous fix used only 3 × 50ms = 150ms which was insufficient on slow systems
// Increased to handle slower machines while minimizing delay on fast ones
// FilteredItemsSelectionDialog.refresh() now uses Display.asyncExec() to apply
// selection after table refresh completes, so we need to process those async events
for (int i = 0; i < 5; i++) {
processUIEvents();
try {
Expand Down
Loading