Ver código fonte

Only enable delete menu item for root nodes

master
Shadowfacts 1 ano atrás
pai
commit
9e258b71f4
Acessado por: shadowfacts ID da chave GPG: 94A5AB95422746E5
1 arquivos alterados com 5 adições e 1 exclusões
  1. +5
    -1
      MongoView/View Controllers/QueryViewController.swift

+ 5
- 1
MongoView/View Controllers/QueryViewController.swift Ver arquivo

@ -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
}


Carregando…
Cancelar
Salvar