From 1f61c15c5b5cc6955533865c811775af3bd58e3e Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Tue, 10 Nov 2009 00:34:38 +0000 Subject: Validate the the 'Clear Console' menu item in TableDocument in addition to SPQueryController as it will never be called in SPQueryController if the console isn't visible. --- Source/SPQueryController.m | 1 + Source/TableDocument.m | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 8d38e72f..eeca9323 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -395,6 +395,7 @@ static SPQueryController *sharedQueryController = nil; return ([consoleTableView numberOfSelectedRows] > 0); } + // Clear console if ([menuItem action] == @selector(clearConsole:)) { return ([self consoleMessageCount] > 0); } diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 253f54f5..a4f078a3 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -2803,7 +2803,6 @@ */ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - if ([menuItem menu] == chooseDatabaseButton) { return (_isConnected && databaseListIsSelectable); } @@ -2908,6 +2907,11 @@ if ([menuItem action] == @selector(toggleConsole:)) { [menuItem setTitle:([[[SPQueryController sharedQueryController] window] isVisible]) ? NSLocalizedString(@"Hide Console", @"hide console") : NSLocalizedString(@"Show Console", @"show console")]; } + + // Clear console + if ([menuItem action] == @selector(clearConsole:)) { + return ([[SPQueryController sharedQueryController] consoleMessageCount] > 0); + } return [super validateMenuItem:menuItem]; } -- cgit v1.2.3