private void updateButtons() { final int[] selectedRows = myEntryTable.getSelectedRows(); boolean removeButtonEnabled = true; int minRow = myEntryTable.getRowCount() + 1; int maxRow = -1; for (final int selectedRow : selectedRows) { minRow = Math.min(minRow, selectedRow); maxRow = Math.max(maxRow, selectedRow); final ClasspathTableItem<?> item = myModel.getItemAt(selectedRow); if (!item.isRemovable()) { removeButtonEnabled = false; } } if (myRemoveButton != null) { myRemoveButton.setEnabled(removeButtonEnabled && selectedRows.length > 0); } ClasspathTableItem<?> selectedItem = selectedRows.length == 1 ? myModel.getItemAt(selectedRows[0]) : null; myEditButton.setEnabled(selectedItem != null && selectedItem.isEditable()); }
@Override protected void updatePropagateButtons() { super.updatePropagateButtons(); myPropExceptionsButton.setEnabled(!isGenerateDelegate() && mayPropagateExceptions()); }
private void update() { CheckedTreeNode node = getSelectedToolNode(); Tool selectedTool = getSelectedTool(); ToolsGroup selectedGroup = getSelectedToolGroup(); if (selectedTool != null) { myAddButton.setEnabled(true); myCopyButton.setEnabled(true); myEditButton.setEnabled(true); myMoveDownButton.setEnabled(isMovingAvailable(node, Direction.DOWN)); myMoveUpButton.setEnabled(isMovingAvailable(node, Direction.UP)); myRemoveButton.setEnabled(true); } else if (selectedGroup != null) { myAddButton.setEnabled(true); myCopyButton.setEnabled(false); myEditButton.setEnabled(false); myMoveDownButton.setEnabled(isMovingAvailable(node, Direction.DOWN)); myMoveUpButton.setEnabled(isMovingAvailable(node, Direction.UP)); myRemoveButton.setEnabled(true); } else { myAddButton.setEnabled(true); myCopyButton.setEnabled(false); myEditButton.setEnabled(false); myMoveDownButton.setEnabled(false); myMoveUpButton.setEnabled(false); myRemoveButton.setEnabled(false); } (getModel()).nodeStructureChanged(null); myTree.repaint(); }