void () { final Collection<DefaultMutableTreeNode> selectedInjections = myParamsTable.getSelection(); boolean enabledExists = false; boolean disabledExists = false; for (DefaultMutableTreeNode node : selectedInjections) { final Boolean nodeSelected = isNodeSelected(node); if (Boolean.TRUE == nodeSelected) enabledExists = true; else if (Boolean.FALSE == nodeSelected) disabledExists = true; if (enabledExists && disabledExists) break; } boolean allEnabled = !enabledExists && disabledExists; for (DefaultMutableTreeNode node : selectedInjections) { setNodeSelected(node, allEnabled); } myParamsTable.updateUI(); }