Sfoglia il codice sorgente

Only enable delete menu item for root nodes

master
Shadowfacts 1 anno fa
parent
commit
9e258b71f4
Firmato da: shadowfacts ID Chiave GPG: 94A5AB95422746E5
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. +5
    -1
      MongoView/View Controllers/QueryViewController.swift

+ 5
- 1
MongoView/View Controllers/QueryViewController.swift Vedi File

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


Caricamento…
Annulla
Salva