     
     
     
+    // MARK: User Interface Validations
+    
+    func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
+        
+        guard let action = item.action else { return false }
+        
+        switch action {
+        case #selector(showOpacityPanel):
+            return !NSApp.orderedDocuments.isEmpty
+            
+        default:
+            return true
+        }
+    }
+    
+    
+    
     // MARK: Action Messages
     
     /// activate self and perform "New" menu action

        menu.addItem(NSMenuItem.separator())
        
        // add syntax styles
        let styleNames = SyntaxManager.shared.styleNames
        for styleName in styleNames {
            menu.addItem(withTitle: styleName, action: #selector(SyntaxHolder.changeSyntaxStyle), keyEquivalent: "")
        }
        menu.addItem(NSMenuItem.separator())

        
        menu.removeAllItems()
        
        for themeName in ThemeManager.shared.themeNames {
            menu.addItem(withTitle: themeName, action: #selector(ThemeHolder.changeTheme), keyEquivalent: "")
        }
    }
