diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPNavigatorController.h | 2 | ||||
-rw-r--r-- | Source/SPNavigatorController.m | 17 | ||||
-rw-r--r-- | 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 |