diff options
Diffstat (limited to 'Source/SPQueryConsole.m')
-rw-r--r-- | Source/SPQueryConsole.m | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/SPQueryConsole.m b/Source/SPQueryConsole.m index 7b7edccb..0ba6c982 100644 --- a/Source/SPQueryConsole.m +++ b/Source/SPQueryConsole.m @@ -225,6 +225,14 @@ static SPQueryConsole *sharedQueryConsole = nil; } /** + * Returns the number of messages currently in the console. + */ +- (NSUInteger)consoleMessageCount +{ + return [messages count]; +} + +/** * Called when the NSSavePanel sheet ends. Writes the console's current content to the selected file if required. */ - (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo @@ -310,6 +318,10 @@ static SPQueryConsole *sharedQueryConsole = nil; if ([menuItem action] == @selector(copy:)) { return ([consoleTableView numberOfSelectedRows] > 0); } + + if ([menuItem action] == @selector(clearConsole:)) { + return ([self consoleMessageCount] > 0); + } return [[self window] validateMenuItem:menuItem]; } |