aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-09 09:39:34 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-09 09:39:34 +0000
commita896123760846a4e38c5061f335056ca8658d013 (patch)
tree57dcbde9cb2c8ebf76601fd8e7124d2ab21390f6 /Source
parentaa0a178df3316777c001c59e03c534cfa537b365 (diff)
downloadsequelpro-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')
-rw-r--r--Source/SPNarrowDownCompletion.m58
-rw-r--r--Source/TableDocument.h1
-rw-r--r--Source/TableDocument.m13
-rw-r--r--Source/TablesList.h1
-rw-r--r--Source/TablesList.m8
5 files changed, 81 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;
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index bb91fa5a..4be47ae1 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -227,6 +227,7 @@
- (IBAction)saveCreateSyntax:(id)sender;
- (IBAction)copyCreateTableSyntaxFromSheet:(id)sender;
- (IBAction)focusOnTableContentFilter:(id)sender;
+- (IBAction)focusOnTableListFilter:(id)sender;
// Other methods
- (void) setQueryMode:(NSInteger)theQueryMode;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index e72f0b86..8e7ba817 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -2340,6 +2340,14 @@
[tableContentInstance performSelector:@selector(makeContentFilterHaveFocus) withObject:nil afterDelay:0.1];
}
+/**
+ * Makes the tables list filter field the first responder.
+ */
+- (IBAction)focusOnTableListFilter:(id)sender
+{
+ [tablesListInstance performSelector:@selector(makeTableListFilterHaveFocus) withObject:nil afterDelay:0.1];
+}
+
#pragma mark -
#pragma mark Other Methods
@@ -3187,6 +3195,11 @@
return ([self table] != nil && [[self table] isNotEqualTo:@""]);
}
+ // Focus on table list filter
+ if ([menuItem action] == @selector(focusOnTableListFilter:)) {
+ return ([[tablesListInstance valueForKeyPath:@"tables"] count] > 20);
+ }
+
return [super validateMenuItem:menuItem];
}
diff --git a/Source/TablesList.h b/Source/TablesList.h
index aa87dbe0..acdd28c7 100644
--- a/Source/TablesList.h
+++ b/Source/TablesList.h
@@ -124,6 +124,7 @@ enum sp_table_types
- (void)updateSelectionTask;
- (void)setSelection:(NSDictionary *)selectionDetails;
- (void)selectTableAtIndex:(NSNumber *)row;
+- (void)makeTableListFilterHaveFocus;
// Getters
- (NSArray *)selectedTableNames;
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 8e4ae268..a344ced5 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -1584,6 +1584,14 @@
}
/**
+ * Set focus to table list filter search field
+ */
+- (void) makeTableListFilterHaveFocus
+{
+ [tableWindow makeFirstResponder:listFilterField];
+}
+
+/**
* Update the filter search.
*/
- (IBAction) updateFilter:(id)sender