From 943614e09a2cb7f40efe4bc647b80e25d1cb7b54 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 16 May 2016 21:54:38 +0200 Subject: Fix an issue with autocompletion not suggesting column names (#2507) Issue introduced in b7875e8fdbdc5980c12a847997cc9631979dd4d3 --- Source/SPDatabaseStructure.h | 1 + Source/SPDatabaseStructure.m | 5 +++++ Source/SPNavigatorController.h | 4 ++-- Source/SPNavigatorController.m | 18 ++++++------------ 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'Source') diff --git a/Source/SPDatabaseStructure.h b/Source/SPDatabaseStructure.h index 05ae9ecc..1c644d24 100644 --- a/Source/SPDatabaseStructure.h +++ b/Source/SPDatabaseStructure.h @@ -54,6 +54,7 @@ // Information - (SPMySQLConnection *)connection; +- (SPDatabaseDocument *)delegate; // Structure retrieval from the server - (void)queryDbStructureInBackgroundWithUserInfo:(NSDictionary *)userInfo; diff --git a/Source/SPDatabaseStructure.m b/Source/SPDatabaseStructure.m index f6b449e2..8eed2607 100644 --- a/Source/SPDatabaseStructure.m +++ b/Source/SPDatabaseStructure.m @@ -127,6 +127,11 @@ return [c autorelease]; } +- (SPDatabaseDocument *)delegate +{ + return delegate; +} + #pragma mark - #pragma mark Structure retrieval from the server diff --git a/Source/SPNavigatorController.h b/Source/SPNavigatorController.h index 76f211c4..c3792312 100644 --- a/Source/SPNavigatorController.h +++ b/Source/SPNavigatorController.h @@ -28,7 +28,7 @@ // // More info at -@class SPNavigatorOutlineView, SPSplitView; +@class SPNavigatorOutlineView, SPSplitView, SPDatabaseDocument; @interface SPNavigatorController : NSWindowController { @@ -79,7 +79,7 @@ - (void)reloadAfterFiltering; - (IBAction)syncButtonAction:(id)sender; -- (void)updateEntriesForConnection:(id)object; +- (void)updateEntriesForConnection:(SPDatabaseDocument *)doc; - (NSString*)tableInfoLabelForIndex:(NSInteger)index ofType:(NSInteger)type; - (void)updateNavigator:(NSNotification *)aNotification; diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index de7bd188..108727fb 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -168,8 +168,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte functionIcon = [[NSImage imageNamed:@"func-small"] retain]; fieldIcon = [[NSImage imageNamed:@"field-small-square"] retain]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateNavigator:) - name:@"SPDBStructureWasUpdated" object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateNavigator:) name:@"SPDBStructureWasUpdated" object:nil]; } @@ -408,16 +407,12 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte - (void)updateNavigator:(NSNotification *)aNotification { + SPDatabaseDocument *object = [(SPDatabaseStructure *)[aNotification object] delegate]; - id object = [aNotification object]; - - if([object isKindOfClass:[SPDatabaseDocument class]]) - [self performSelectorOnMainThread:@selector(updateEntriesForConnection:) withObject:object waitUntilDone:NO]; - else - [self performSelectorOnMainThread:@selector(updateEntriesForConnection:) withObject:nil waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(updateEntriesForConnection:) withObject:object waitUntilDone:NO]; } -- (void)updateEntriesForConnection:(id)doc +- (void)updateEntriesForConnection:(SPDatabaseDocument *)doc { if(ignoreUpdate) { @@ -431,8 +426,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte [cachedSortedKeys removeAllObjects]; } - - if (doc && [doc isKindOfClass:[SPDatabaseDocument class]]) { + if (doc) { SPMySQLConnection *theConnection = [doc getConnection]; if(!theConnection || ![theConnection isConnected]) return; @@ -488,7 +482,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte if(isFiltered && [[self window] isVisible]) [self filterTree:self]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"SPNavigatorStructureWasUpdated" object:doc]; + [[NSNotificationCenter defaultCenter] postNotificationName:@"SPNavigatorStructureWasUpdated" object:self]; } -- cgit v1.2.3