浏览代码

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
}


正在加载...
取消
保存