aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2016-05-16 21:54:38 +0200
committerMax <post@wickenrode.com>2016-05-16 21:54:38 +0200
commit943614e09a2cb7f40efe4bc647b80e25d1cb7b54 (patch)
treebeb04e436898acba9bc57488b878f32911aa40bc /Source
parent05407e7246a5781dd2523feac920d6fcc0f08f79 (diff)
downloadsequelpro-943614e09a2cb7f40efe4bc647b80e25d1cb7b54.tar.gz
sequelpro-943614e09a2cb7f40efe4bc647b80e25d1cb7b54.tar.bz2
sequelpro-943614e09a2cb7f40efe4bc647b80e25d1cb7b54.zip
Fix an issue with autocompletion not suggesting column names (#2507)
Issue introduced in b7875e8fdbdc5980c12a847997cc9631979dd4d3
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDatabaseStructure.h1
-rw-r--r--Source/SPDatabaseStructure.m5
-rw-r--r--Source/SPNavigatorController.h4
-rw-r--r--Source/SPNavigatorController.m18
4 files changed, 14 insertions, 14 deletions
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 <https://github.com/sequelpro/sequelpro>
-@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];
}