void () { final CommonActionsPanel p = getActionsPanel(); if (p != null) { boolean someElementSelected; if (myList.isEnabled()) { final int index = myList.getSelectedIndex(); someElementSelected = 0 <= index && index < myList.getModel().getSize(); if (someElementSelected) { final boolean downEnable = myList.getMaxSelectionIndex() < myList.getModel().getSize() - 1; final boolean upEnable = myList.getMinSelectionIndex() > 0; final boolean editEnabled = myList.getSelectedIndices().length == 1; p.setEnabled(CommonActionsPanel.Buttons.EDIT, editEnabled); p.setEnabled(CommonActionsPanel.Buttons.UP, upEnable); p.setEnabled(CommonActionsPanel.Buttons.DOWN, downEnable); } else { p.setEnabled(CommonActionsPanel.Buttons.EDIT, false); p.setEnabled(CommonActionsPanel.Buttons.UP, false); p.setEnabled(CommonActionsPanel.Buttons.DOWN, false); } p.setEnabled(CommonActionsPanel.Buttons.ADD, true); } else { someElementSelected = false; p.setEnabled(CommonActionsPanel.Buttons.ADD, false); p.setEnabled(CommonActionsPanel.Buttons.UP, false); p.setEnabled(CommonActionsPanel.Buttons.DOWN, false); } p.setEnabled(CommonActionsPanel.Buttons.REMOVE, someElementSelected); updateExtraElementActions(someElementSelected); } }