void () { final CommonActionsPanel p = getActionsPanel(); if (p != null) { boolean someElementSelected; if (myTable.isEnabled()) { final int index = myTable.getSelectedRow(); final int size = myTable.getModel().getRowCount(); someElementSelected = 0 <= index && index < size; if (someElementSelected) { final boolean downEnable = myTable.getSelectionModel().getMaxSelectionIndex() < size - 1; final boolean upEnable = myTable.getSelectionModel().getMinSelectionIndex() > 0; final boolean editEnabled = myTable.getSelectedRowCount() == 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, myProducer == null || myProducer.canCreateElement()); } else { someElementSelected = false; p.setEnabled(CommonActionsPanel.Buttons.ADD, false); p.setEnabled(CommonActionsPanel.Buttons.EDIT, false); p.setEnabled(CommonActionsPanel.Buttons.UP, false); p.setEnabled(CommonActionsPanel.Buttons.DOWN, false); } p.setEnabled(CommonActionsPanel.Buttons.REMOVE, someElementSelected); updateExtraElementActions(someElementSelected); } }