diff options
-rw-r--r-- | Source/SPDatabaseDocument.m | 17 | ||||
-rw-r--r-- | Source/SPStringAdditions.m | 8 | ||||
-rw-r--r-- | Source/SPTablesList.h | 1 | ||||
-rw-r--r-- | Source/SPTablesList.m | 40 |
4 files changed, 62 insertions, 4 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 4ef38ef8..7c838a0e 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -4405,6 +4405,23 @@ return; } + if([command isEqualToString:@"SelectTables"]) { + if([params count] > 1) { + [tablesListInstance selectItemsWithNames:[params subarrayWithRange:NSMakeRange(1, [params count]-1)]]; + } + return; + } + + if([command isEqualToString:@"ReloadContentTable"]) { + [tablesListInstance updateTables:self]; + return; + } + + if([command isEqualToString:@"ReloadTablesList"]) { + [tableContentInstance reloadTable:self]; + return; + } + else if([command isEqualToString:@"SelectDatabase"]) { if (_isWorkingLevel) return; if([params count] > 1) { diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m index be91fa0b..ea3f6385 100644 --- a/Source/SPStringAdditions.m +++ b/Source/SPStringAdditions.m @@ -483,10 +483,10 @@ if(doc != nil) { [doc setProcessID:processID]; - [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryInputPathHeader, processID] forKey:@"SP_QUERY_FILE_PATH"]; - [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultPathHeader, processID] forKey:@"SP_QUERY_RESULT_FILE_PATH"]; - [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultStatusPathHeader, processID] forKey:@"SP_QUERY_RESULT_STATUS_FILE_PATH"]; - [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultMetaPathHeader, processID] forKey:@"SP_QUERY_RESULT_META_FILE_PATH"]; + [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryInputPathHeader, processID] forKey:@"SP_QUERY_FILE"]; + [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultPathHeader, processID] forKey:@"SP_QUERY_RESULT_FILE"]; + [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultStatusPathHeader, processID] forKey:@"SP_QUERY_RESULT_STATUS_FILE"]; + [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultMetaPathHeader, processID] forKey:@"SP_QUERY_RESULT_META_FILE"]; if([doc shellVariables]) [theEnv addEntriesFromDictionary:[doc shellVariables]]; diff --git a/Source/SPTablesList.h b/Source/SPTablesList.h index 1ae4eecd..56711217 100644 --- a/Source/SPTablesList.h +++ b/Source/SPTablesList.h @@ -141,6 +141,7 @@ - (void)setContentRequiresReload:(BOOL)reload; - (void)setStatusRequiresReload:(BOOL)reload; - (BOOL)selectItemWithName:(NSString *)theName; +- (BOOL)selectItemsWithNames:(NSArray *)theNames; // Table list filter interaction - (void) showFilter; 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 |