From 836b96f7e1481938c0267448b940b5d8e202eb09 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 31 Mar 2010 19:47:19 +0000 Subject: =?UTF-8?q?=E2=80=A2=20ensure=20that=20the=20global=20schema=20str?= =?UTF-8?q?ucture=20data=20for=20completion=20are=20updated=20even=20if=20?= =?UTF-8?q?SP=20is=20not=20active?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPNavigatorController.h | 2 +- Source/SPNavigatorController.m | 17 ++++++++--------- Source/TableDocument.m | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Source/SPNavigatorController.h b/Source/SPNavigatorController.h index 1926a622..d84598f8 100644 --- a/Source/SPNavigatorController.h +++ b/Source/SPNavigatorController.h @@ -76,7 +76,7 @@ - (IBAction)filterTree:(id)sender; - (IBAction)syncButtonAction:(id)sender; -- (void)updateEntriesForConnection:(NSString*)connectionID; +- (void)updateEntriesForConnection:(id)object; - (NSString*)tableInfoLabelForIndex:(NSInteger)index ofType:(NSInteger)type; - (void)updateNavigator:(NSNotification *)aNotification; diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index 0bb723ba..8261ec2b 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -409,15 +409,16 @@ static SPNavigatorController *sharedNavigatorController = nil; - (void)updateNavigator:(NSNotification *)aNotification { + id object = [aNotification object]; - + if([object isKindOfClass:[TableDocument class]]) - [self performSelectorOnMainThread:@selector(updateEntriesForConnection:) withObject:[object connectionID] waitUntilDone:YES]; + [self performSelectorOnMainThread:@selector(updateEntriesForConnection:) withObject:object waitUntilDone:NO]; else - [self performSelectorOnMainThread:@selector(updateEntriesForConnection:) withObject:nil waitUntilDone:YES]; + [self performSelectorOnMainThread:@selector(updateEntriesForConnection:) withObject:nil waitUntilDone:NO]; } -- (void)updateEntriesForConnection:(NSString*)connectionID +- (void)updateEntriesForConnection:(id)doc { if(ignoreUpdate) { @@ -430,15 +431,15 @@ static SPNavigatorController *sharedNavigatorController = nil; [infoArray removeAllObjects]; } - id doc = nil; - if ([[[NSDocumentController sharedDocumentController] documents] count]) { + if (doc && [doc isKindOfClass:[TableDocument class]] && [[[NSDocumentController sharedDocumentController] documents] count]) { - doc = [[NSDocumentController sharedDocumentController] currentDocument]; id theConnection = [doc valueForKeyPath:@"mySQLConnection"]; if(!theConnection || ![theConnection isConnected]) return; + NSString *connectionID = [doc connectionID]; + NSString *connectionName = [doc connectionID]; if(!connectionName || [connectionName isEqualToString:@"_"] || (connectionID && ![connectionName isEqualToString:connectionID]) ) { @@ -447,7 +448,6 @@ static SPNavigatorController *sharedNavigatorController = nil; [updatingConnections addObject:connectionName]; - if(![schemaData objectForKey:connectionName]) { [schemaData setObject:[NSMutableDictionary dictionary] forKey:connectionName]; } @@ -493,7 +493,6 @@ static SPNavigatorController *sharedNavigatorController = nil; [[NSNotificationCenter defaultCenter] postNotificationName:@"SPNavigatorStructureWasUpdated" object:doc]; - } - (BOOL)schemaPathExistsForConnection:(NSString*)connectionID andDatabase:(NSString*)dbname diff --git a/Source/TableDocument.m b/Source/TableDocument.m index e850f443..b8527698 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1164,7 +1164,7 @@ BOOL isNavigatorVisible = [[[SPNavigatorController sharedNavigatorController] window] isVisible]; if(!isNavigatorVisible) { - [[SPNavigatorController sharedNavigatorController] updateEntriesForConnection:[self connectionID]]; + [[SPNavigatorController sharedNavigatorController] updateEntriesForConnection:self]; } // Show or hide the navigator -- cgit v1.2.3