Skip to content

Commit 943614e

Browse files
committed
Fix an issue with autocompletion not suggesting column names (#2507)
Issue introduced in b7875e8
1 parent 05407e7 commit 943614e

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

Source/SPDatabaseStructure.h

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
// Information
5656
- (SPMySQLConnection *)connection;
57+
- (SPDatabaseDocument *)delegate;
5758

5859
// Structure retrieval from the server
5960
- (void)queryDbStructureInBackgroundWithUserInfo:(NSDictionary *)userInfo;

Source/SPDatabaseStructure.m

+5
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ - (SPMySQLConnection *)connection
127127
return [c autorelease];
128128
}
129129

130+
- (SPDatabaseDocument *)delegate
131+
{
132+
return delegate;
133+
}
134+
130135
#pragma mark -
131136
#pragma mark Structure retrieval from the server
132137

Source/SPNavigatorController.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
//
2929
// More info at <https://github.com/sequelpro/sequelpro>
3030

31-
@class SPNavigatorOutlineView, SPSplitView;
31+
@class SPNavigatorOutlineView, SPSplitView, SPDatabaseDocument;
3232

3333
@interface SPNavigatorController : NSWindowController
3434
{
@@ -79,7 +79,7 @@
7979
- (void)reloadAfterFiltering;
8080
- (IBAction)syncButtonAction:(id)sender;
8181

82-
- (void)updateEntriesForConnection:(id)object;
82+
- (void)updateEntriesForConnection:(SPDatabaseDocument *)doc;
8383
- (NSString*)tableInfoLabelForIndex:(NSInteger)index ofType:(NSInteger)type;
8484

8585
- (void)updateNavigator:(NSNotification *)aNotification;

Source/SPNavigatorController.m

+6-12
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ - (void)awakeFromNib
168168
functionIcon = [[NSImage imageNamed:@"func-small"] retain];
169169
fieldIcon = [[NSImage imageNamed:@"field-small-square"] retain];
170170

171-
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateNavigator:)
172-
name:@"SPDBStructureWasUpdated" object:nil];
171+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateNavigator:) name:@"SPDBStructureWasUpdated" object:nil];
173172

174173
}
175174

@@ -408,16 +407,12 @@ - (void)selectInActiveDocumentItem:(id)item fromView:(id)outlineView
408407

409408
- (void)updateNavigator:(NSNotification *)aNotification
410409
{
410+
SPDatabaseDocument *object = [(SPDatabaseStructure *)[aNotification object] delegate];
411411

412-
id object = [aNotification object];
413-
414-
if([object isKindOfClass:[SPDatabaseDocument class]])
415-
[self performSelectorOnMainThread:@selector(updateEntriesForConnection:) withObject:object waitUntilDone:NO];
416-
else
417-
[self performSelectorOnMainThread:@selector(updateEntriesForConnection:) withObject:nil waitUntilDone:NO];
412+
[self performSelectorOnMainThread:@selector(updateEntriesForConnection:) withObject:object waitUntilDone:NO];
418413
}
419414

420-
- (void)updateEntriesForConnection:(id)doc
415+
- (void)updateEntriesForConnection:(SPDatabaseDocument *)doc
421416
{
422417

423418
if(ignoreUpdate) {
@@ -431,8 +426,7 @@ - (void)updateEntriesForConnection:(id)doc
431426
[cachedSortedKeys removeAllObjects];
432427
}
433428

434-
435-
if (doc && [doc isKindOfClass:[SPDatabaseDocument class]]) {
429+
if (doc) {
436430

437431
SPMySQLConnection *theConnection = [doc getConnection];
438432
if(!theConnection || ![theConnection isConnected]) return;
@@ -488,7 +482,7 @@ - (void)updateEntriesForConnection:(id)doc
488482
if(isFiltered && [[self window] isVisible])
489483
[self filterTree:self];
490484

491-
[[NSNotificationCenter defaultCenter] postNotificationName:@"SPNavigatorStructureWasUpdated" object:doc];
485+
[[NSNotificationCenter defaultCenter] postNotificationName:@"SPNavigatorStructureWasUpdated" object:self];
492486

493487
}
494488

0 commit comments

Comments
 (0)