aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-01-13 20:53:39 +0000
committerBibiko <bibiko@eva.mpg.de>2010-01-13 20:53:39 +0000
commit08fb692301568e7143271ffad9bbcb3a5b247de5 (patch)
treeeedeb574fb2859cb1bcb9ae2d237206f9c4f38fd /Source/CMTextView.m
parentaeb5ec548006a76e926a2bd982b362e13251841b (diff)
downloadsequelpro-08fb692301568e7143271ffad9bbcb3a5b247de5.tar.gz
sequelpro-08fb692301568e7143271ffad9bbcb3a5b247de5.tar.bz2
sequelpro-08fb692301568e7143271ffad9bbcb3a5b247de5.zip
• fixed several sheetDidEnd selectors to close a NSAlert or NSWindow properly to avoid overlapping sheets
• F5 completion - if a table is selected and no further parsing info is given show that table and its fields at the top of the suggestions
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m13
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 1359b8d8..06ada98e 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -216,6 +216,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSString *currentDb = nil;
NSString *currentTable = nil;
+
if ([[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"selectedDatabase"] != nil)
currentDb = [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKeyPath:@"selectedDatabase"];
if ([[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"tableName"] != nil)
@@ -257,12 +258,18 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
for(id db in sortedDbs) {
NSArray *allTables = [[dbs objectForKey:db] allKeys];
- NSArray *sortedTables;
+ NSMutableArray *sortedTables = [NSMutableArray array];
if(aTableNameExists) {
- sortedTables = [NSArray arrayWithObject:aTableName];
+ [sortedTables addObject:aTableName];
} else {
[possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:db, @"display", @"database-small", @"image", nil]];
- sortedTables= [allTables sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]];
+ [sortedTables addObjectsFromArray:[allTables sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]];
+ // if(aDbName == nil && aTableName) {
+ if([sortedTables count] > 1 && [sortedTables containsObject:currentTable]) {
+ [sortedTables removeObject:currentTable];
+ [sortedTables insertObject:currentTable atIndex:0];
+ }
+ // }
}
for(id table in sortedTables) {
NSDictionary * theTable = [[dbs objectForKey:db] objectForKey:table];