fTable.setRedraw(true);
itemCount = fTable.getItemCount();
}
// table empty -> no selection
if (fCount == 0) {
fTable.notifyListeners(SWT.Selection, new Event());
return Status.OK_STATUS;
}
// How many we are going to do this time.
int iterations = Math.min(10, fCount - currentIndex);
for (int i = 0; i < iterations; i++) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
final TableItem item = (currentIndex < itemCount) ? fTable
.getItem(currentIndex)
: new TableItem(fTable, SWT.NONE);
final Label label = fLabels[fFilteredIndices[fFoldedIndices[currentIndex]]];
item.setText(label.string);
item.setImage(label.image);
currentIndex++;
}
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
if (currentIndex < fCount) {
schedule(100);
} else {
if (indicesToSelect == null) {
// Make a default selection in the table if there is none.
// If a selection has already been made, honor it.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=112146
if (fCount > 0) {
if (fTable.getSelectionIndices().length == 0) {
defaultSelect();
} else {
// There is a selection, but it likely hasn't changed since the
// job started. Force a selection notification, since the
// items represented by the selection have changed.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=119456
fTable.notifyListeners(SWT.Selection, new Event());
}
}
} else {
// Set the selection as indicated.
selectAndNotify(indicesToSelect);