aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-31 19:47:19 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-31 19:47:19 +0000
commit836b96f7e1481938c0267448b940b5d8e202eb09 (patch)
tree3fc5ca7d44acbac56c73270779d05a93c8411db8 /Source
parent841c9a5e1fc35a6aa2cb0d488057f504c1c9b378 (diff)
downloadsequelpro-836b96f7e1481938c0267448b940b5d8e202eb09.tar.gz
sequelpro-836b96f7e1481938c0267448b940b5d8e202eb09.tar.bz2
sequelpro-836b96f7e1481938c0267448b940b5d8e202eb09.zip
• ensure that the global schema structure data for completion are updated even if SP is not active
Diffstat (limited to 'Source')
-rw-r--r--Source/SPNavigatorController.h2
-rw-r--r--Source/SPNavigatorController.m17
-rw-r--r--Source/TableDocument.m2
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