 final class BatchReplacementViewController: NSViewController {
     
     private dynamic var hasInvalidSetting = false
+    private dynamic var canPerform = true
     private dynamic var resultMessage: String?
     
     

    
    /// reset previous search result
    override func viewWillAppear() {
        
        self.resultMessage = nil
    }

    
    @objc private func validateObject() {
        
        guard let batchReplacement = self.representedObject as? BatchReplacement else { return }
        
        self.hasInvalidSetting = batchReplacement.replacements.contains { $0.localizedError != nil }
        
        self.canPerform = batchReplacement.replacements.contains { replacement in
            do {
                try replacement.validate()
            } catch {
                return false
            }
            return true
        }
    }
    
}
