From: David ‘Bombe’ Roden Date: Thu, 9 Jun 2011 19:33:04 +0000 (+0200) Subject: Prevent deletion of the last node. X-Git-Tag: 0.10-rc1~70 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=bb1eccdace92539e122c9e4b3b8bd1486615d688;p=jSite.git Prevent deletion of the last node. This fixes #183. --- diff --git a/src/de/todesbaum/jsite/gui/NodeManagerPage.java b/src/de/todesbaum/jsite/gui/NodeManagerPage.java index 951a912..0f38a55 100644 --- a/src/de/todesbaum/jsite/gui/NodeManagerPage.java +++ b/src/de/todesbaum/jsite/gui/NodeManagerPage.java @@ -331,6 +331,7 @@ public class NodeManagerPage extends TWizardPage implements ListSelectionListene private void addNode() { Node node = new Node("localhost", 9481, I18n.getMessage("jsite.node-manager.new-node")); nodeListModel.addElement(node); + deleteNodeAction.setEnabled(nodeListModel.size() > 1); wizard.setNextEnabled(true); fireNodesUpdated(getNodes()); } @@ -349,6 +350,7 @@ public class NodeManagerPage extends TWizardPage implements ListSelectionListene nodeListModel.removeElement(node); nodeList.repaint(); fireNodesUpdated(getNodes()); + deleteNodeAction.setEnabled(nodeListModel.size() > 1); wizard.setNextEnabled(nodeListModel.size() > 0); } @@ -370,7 +372,7 @@ public class NodeManagerPage extends TWizardPage implements ListSelectionListene nodeNameTextField.setEnabled(enabled); nodeHostnameTextField.setEnabled(enabled); nodePortSpinner.setEnabled(enabled); - deleteNodeAction.setEnabled(enabled); + deleteNodeAction.setEnabled(enabled && (nodeListModel.size() > 1)); if (enabled) { nodeNameTextField.setText(node.getName()); nodeHostnameTextField.setText(node.getHostname());