From f37e308174721f2b2a8cb704fad9eb810bf0e273 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Mon, 24 Sep 2012 03:42:30 +0000 Subject: Fix r3857 regression. There is no table name when more than one item is selected. --- Source/SPTablesList.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Source') diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index c2a773bc..4da69390 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -1760,6 +1760,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; - (NSDragOperation)tableView:(NSTableView *)aTableView validateDrop:(id < NSDraggingInfo >)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)operation { [tablesListView setDropRow:row dropOperation:NSTableViewDropAbove]; + return NSDragOperationCopy; } @@ -1772,14 +1773,19 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { SEL action = [menuItem action]; + NSInteger selectedRows = [tablesListView numberOfSelectedRows]; if (action == @selector(copyTable:) || action == @selector(renameTable:) || - action == @selector(removeTable:) || - action == @selector(truncateTable:) || action == @selector(openTableInNewTab:)) { - return [tablesListView numberOfSelectedRows] == 1 && [[self tableName] length]; + return selectedRows == 1 && [[self tableName] length]; + } + + if (action == @selector(removeTable:) || + action == @selector(truncateTable:)) + { + return selectedRows > 0; } return [super validateMenuItem:menuItem]; -- cgit v1.2.3