private void enableSelectAllButtons() { int itemCount = getValidProjects().length; int selectionCount = projectsList.getCheckedLeafCount(); selectAll.setEnabled(itemCount > selectionCount && itemCount > 0); deselectAll.setEnabled(selectionCount > 0); }