Only enable delete menu item for root nodes
This commit is contained in:
parent
b971952217
commit
9e258b71f4
|
@ -173,7 +173,11 @@ class QueryViewController: NSViewController {
|
|||
extension QueryViewController: NSMenuItemValidation {
|
||||
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
|
||||
if menuItem.action == #selector(deleteNode(_:)) {
|
||||
return outlineView.clickedRow != -1
|
||||
if outlineView.clickedRow != -1, let node = outlineView.item(atRow: outlineView.clickedRow) as? Node, node.parent == nil {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue