diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-03-09 09:39:34 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-03-09 09:39:34 +0000 |
commit | a896123760846a4e38c5061f335056ca8658d013 (patch) | |
tree | 57dcbde9cb2c8ebf76601fd8e7124d2ab21390f6 /Source/SPNarrowDownCompletion.m | |
parent | aa0a178df3316777c001c59e03c534cfa537b365 (diff) | |
download | sequelpro-a896123760846a4e38c5061f335056ca8658d013.tar.gz sequelpro-a896123760846a4e38c5061f335056ca8658d013.tar.bz2 sequelpro-a896123760846a4e38c5061f335056ca8658d013.zip |
• improved tooltip behaviour of SPNarrowDownCompletion's tableView
• added "Filter Tables…" ^⌥⌘F" to main menu > Table which sets the focus to TablesList's search field if visible
Diffstat (limited to 'Source/SPNarrowDownCompletion.m')
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index ea6752f6..2651024a 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -298,6 +298,64 @@ return [filtered count]; } +- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:(id)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex mouseLocation:(NSPoint)mouseLocation +{ + if([[aTableColumn identifier] isEqualToString:@"image"]) { + if(!dictMode) { + NSString *imageName = [[filtered objectAtIndex:rowIndex] objectForKey:@"image"]; + if([imageName hasPrefix:@"dummy"]) + return @""; + if([imageName hasPrefix:@"table-view"]) + return @"view"; + if([imageName hasPrefix:@"table"]) + return @"table"; + if([imageName hasPrefix:@"database"]) + return @"database"; + if([imageName hasPrefix:@"func"]) + return @"function"; + if([imageName hasPrefix:@"proc"]) + return @"procedure"; + if([imageName hasPrefix:@"field"]) + return @"field"; + } + return @""; + } else if([[aTableColumn identifier] isEqualToString:@"name"]) { + return [[filtered objectAtIndex:rowIndex] objectForKey:@"display"]; + } else if ([[aTableColumn identifier] isEqualToString:@"list"] || [[aTableColumn identifier] isEqualToString:@"type"]) { + if(dictMode) { + return @""; + } else { + if([[filtered objectAtIndex:rowIndex] objectForKey:@"list"]) { + NSMutableString *tt = [NSMutableString string]; + [tt appendString:([[filtered objectAtIndex:rowIndex] objectForKey:@"type"]) ? [[filtered objectAtIndex:rowIndex] objectForKey:@"type"] : @""]; + [tt appendString:@"\n"]; + [tt appendString:NSLocalizedString(@"Type Declaration:", @"type declaration header")]; + [tt appendString:@"\n"]; + [tt appendString:[[filtered objectAtIndex:rowIndex] objectForKey:@"list"]]; + return tt; + } else { + return ([[filtered objectAtIndex:rowIndex] objectForKey:@"type"]) ? [[filtered objectAtIndex:rowIndex] objectForKey:@"type"] : @""; + } + return @""; + } + + } else if ([[aTableColumn identifier] isEqualToString:@"path"]) { + if(dictMode) { + return @""; + } else { + if([[filtered objectAtIndex:rowIndex] objectForKey:@"path"]) { + NSMutableString *tt = [NSMutableString string]; + [tt setString:NSLocalizedString(@"Schema path:", @"schema path header for completion tooltip")]; + for(id p in [[[[[filtered objectAtIndex:rowIndex] objectForKey:@"path"] componentsSeparatedByString:@"⇠"] reverseObjectEnumerator] allObjects]) + [tt appendFormat:@"\n• %@",p]; + return tt; + } + return @""; + } + } + return @""; +} + - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { NSImage* image = nil; |