瀏覽代碼

Only enable delete menu item for root nodes

master
Shadowfacts 1 年前
父節點
當前提交
9e258b71f4
簽署人: shadowfacts GPG 金鑰 ID: 94A5AB95422746E5
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. +5
    -1
      MongoView/View Controllers/QueryViewController.swift

+ 5
- 1
MongoView/View Controllers/QueryViewController.swift 查看文件

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


載入中…
取消
儲存