From 10c7995efabe8ba96fbaaaff88b3f06a8c0d5cde Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Tue, 10 Nov 2009 00:25:42 +0000 Subject: Implement a more reliable way of updating the show/hide console menu item. --- Source/TableDocument.m | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 11a2c102..253f54f5 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1138,13 +1138,6 @@ // Show or hide the console [[[SPQueryController sharedQueryController] window] setIsVisible:(!isConsoleVisible)]; - - // Get the menu item for showing and hiding the console. This is isn't the best way to get it as any - // changes to the menu structure will result in the wrong item being selected. - NSMenuItem *menuItem = [[[[NSApp mainMenu] itemWithTitle:@"View"] submenu] itemAtIndex:5]; - - // Only update the menu item title if its the menu item and not the toolbar - [menuItem setTitle:(!isConsoleVisible) ? NSLocalizedString(@"Hide Console", @"Hide Console") : NSLocalizedString(@"Show Console", @"show console")]; } /** @@ -2910,6 +2903,11 @@ return ([variablesTableView numberOfSelectedRows] > 0); } + + // Show/hide console + if ([menuItem action] == @selector(toggleConsole:)) { + [menuItem setTitle:([[[SPQueryController sharedQueryController] window] isVisible]) ? NSLocalizedString(@"Hide Console", @"hide console") : NSLocalizedString(@"Show Console", @"show console")]; + } return [super validateMenuItem:menuItem]; } -- cgit v1.2.3