Pārlūkot izejas kodu

Only enable delete menu item for root nodes

master
Shadowfacts 4 mēnešus atpakaļ
vecāks
revīzija
9e258b71f4
Parakstījis: Shadowfacts <me@shadowfacts.net> GPG atslēgas ID: 94A5AB95422746E5

+ 5
- 1
MongoView/View Controllers/QueryViewController.swift Parādīt failu

@@ -173,7 +173,11 @@ class QueryViewController: NSViewController {
173 173
 extension QueryViewController: NSMenuItemValidation {
174 174
     func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
175 175
         if menuItem.action == #selector(deleteNode(_:)) {
176
-            return outlineView.clickedRow != -1
176
+            if outlineView.clickedRow != -1, let node = outlineView.item(atRow: outlineView.clickedRow) as? Node, node.parent == nil {
177
+                return true
178
+            } else {
179
+                return false
180
+            }
177 181
         }
178 182
         return true
179 183
     }

Notiek ielāde…
Atcelt
Saglabāt