void () { FrameworkVersion oldSelection = getSelectedVersion(); List<? extends FrameworkVersion> versions = computeAvailableVersions(); myVersionsBox.removeAllItems(); for (FrameworkVersion version : versions) { myVersionsBox.addItem(version); } myVersionsPanel.setVisible(!versions.isEmpty()); if (!versions.isEmpty()) { FrameworkVersion toSelect = oldSelection != null && versions.contains(oldSelection) ? oldSelection : versions.get(versions.size() - 1); myVersionsBox.setSelectedItem(toSelect); myModel.setSelectedVersion(myFrameworkOrGroupId, toSelect); } }