Skip to content

Commit

Permalink
make export dialog add button follow list selection
Browse files Browse the repository at this point in the history
There are potential race conditions that are happening
between the dialog creation with empty list and the
thread that populates the list and fires selection change
events.

An easy hack is to make sure the button is enabled
whenever there are items in the list. This always
works, as the default behavior of list makes sure
that there is at least one item selected in a
non-empty list.

Fixes: #534
  • Loading branch information
gireeshpunathil committed Apr 6, 2023
1 parent 9cddd29 commit 5e2255b
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ public void setElements(Object[] elements) {
super.setElements(elements);
fElements = elements;
}

@Override
protected void updateOkState() {
super.updateOkState();
Button ok = getOkButton();
if (ok != null && !ok.isEnabled()) {
ok.setEnabled(fElements.length != 0);
}
}

public void setConditionalElements(Object[] elements) {
fConditionalElements = elements;
Expand Down

0 comments on commit 5e2255b

Please sign in to comment.