From 994057ae2a82dc110a385ced4239ce49cc0601f8 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 13 Dec 2014 17:20:18 +0100 Subject: Add cast for [NSApp delegate] * (Also changed some outdated URLs) * Replaced [NSApplication sharedApplication] with NSApp --- Source/SPQueryDocumentsController.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/SPQueryDocumentsController.m') diff --git a/Source/SPQueryDocumentsController.m b/Source/SPQueryDocumentsController.m index ba1bc2b1..e42a734b 100644 --- a/Source/SPQueryDocumentsController.m +++ b/Source/SPQueryDocumentsController.m @@ -30,6 +30,7 @@ #import "SPQueryDocumentsController.h" #import "SPCustomQuery.h" +#import "SPAppController.h" @implementation SPQueryController (SPQueryDocumentsController) @@ -122,7 +123,7 @@ #ifndef SP_CODA // Check for multiple instance of the same document. // Remove it if only one instance was registerd. - NSArray *allDocs = [[NSApp delegate] orderedDocuments]; + NSArray *allDocs = [SPAppDelegate orderedDocuments]; NSMutableArray *allURLs = [NSMutableArray array]; for (id doc in allDocs) @@ -202,7 +203,7 @@ } // Inform all opened documents to update the history list - for (id doc in [[NSApp delegate] orderedDocuments]) + for (id doc in [SPAppDelegate orderedDocuments]) { if([[doc valueForKeyPath:@"customQueryInstance"] respondsToSelector:@selector(historyItemsHaveBeenUpdated:)]) { [[doc valueForKeyPath:@"customQueryInstance"] performSelectorOnMainThread:@selector(historyItemsHaveBeenUpdated:) withObject:self waitUntilDone:NO]; -- cgit v1.2.3 From 876dde21d97897ad4ee98aa0d6b11898282982ce Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 13 Dec 2014 18:02:01 +0100 Subject: Change [NSArray arrayWithObject:] to @[] literal Note: [NSArray arrayWithObjects:...,nil] is left unchanged as that could possibly cause a NPE if converted to @[] --- Source/SPQueryDocumentsController.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/SPQueryDocumentsController.m') diff --git a/Source/SPQueryDocumentsController.m b/Source/SPQueryDocumentsController.m index e42a734b..e4689c41 100644 --- a/Source/SPQueryDocumentsController.m +++ b/Source/SPQueryDocumentsController.m @@ -312,7 +312,7 @@ } #endif - return [NSArray array]; + return @[]; } /** @@ -355,7 +355,7 @@ - (NSArray *)queryFavoritesForFileURL:(NSURL *)fileURL andTabTrigger:(NSString *)tabTrigger includeGlobals:(BOOL)includeGlobals { - if (![tabTrigger length]) return [NSArray array]; + if (![tabTrigger length]) return @[]; NSMutableArray *result = [[NSMutableArray alloc] init]; @@ -390,7 +390,7 @@ */ - (NSArray*)functionList { - return (completionFunctionList != nil && [completionFunctionList count]) ? completionFunctionList : [NSArray array]; + return (completionFunctionList != nil && [completionFunctionList count]) ? completionFunctionList : @[]; } /** @@ -398,7 +398,7 @@ */ - (NSArray*)keywordList { - return (completionKeywordList != nil && [completionKeywordList count]) ? completionKeywordList : [NSArray array]; + return (completionKeywordList != nil && [completionKeywordList count]) ? completionKeywordList : @[]; } /** -- cgit v1.2.3