From e30cdeb6ee289fc4221d7b3fc5ec9e58be059675 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Mon, 22 Nov 2010 07:42:35 +0000 Subject: =?UTF-8?q?=E2=80=A2=20renamed=20some=20shell=20variables=20for=20?= =?UTF-8?q?Bundle=20commands=20=E2=80=A2=20added=20sequelpro=20scheme=20co?= =?UTF-8?q?mmands:=20SelectTables,=20ReloadTablesList,=20ReloadContentTabl?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPTablesList.m | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'Source/SPTablesList.m') diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index fc7be0f8..6fdca8c0 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -1155,6 +1155,46 @@ return YES; } +/** + * Try to select items using the provided names in theNames; returns YES if at least + * one item could be seleceted, otherwise NO. + */ +- (BOOL)selectItemsWithNames:(NSArray *)theNames +{ + NSInteger i, tableType; + NSInteger itemIndex = NSNotFound; + NSMutableIndexSet *selectionIndexSet = [NSMutableIndexSet indexSet]; + + // Loop through the unfiltered tables/views to find the desired item + for(NSString* theName in theNames) { + for (i = 0; i < [tables count]; i++) { + tableType = [[tableTypes objectAtIndex:i] integerValue]; + if (tableType == SPTableTypeNone) continue; + if ([[tables objectAtIndex:i] isEqualToString:theName]) { + [selectionIndexSet addIndex:i]; + } + else if ([[tables objectAtIndex:i] compare:theName options:NSCaseInsensitiveSearch|NSLiteralSearch] == NSOrderedSame) + [selectionIndexSet addIndex:i]; + } + } + + // If no match found, return failure + if (![selectionIndexSet count]) return NO; + + if (!isTableListFiltered) { + [tablesListView selectRowIndexes:selectionIndexSet byExtendingSelection:NO]; + } else { + [tablesListView deselectAll:nil]; + [listFilterField setStringValue:@""]; + [self updateFilter:self]; + [tablesListView selectRowIndexes:selectionIndexSet byExtendingSelection:NO]; + } + + [[tablesListView onMainThread] scrollRowToVisible:[tablesListView selectedRow]]; + + return YES; +} + #pragma mark - #pragma mark Datasource methods -- cgit v1.2.3