diff options
author | Max <post@wickenrode.com> | 2014-12-13 19:48:41 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2014-12-13 19:48:41 +0100 |
commit | 3b251b8e3d4dc9a694ef76562b388ab07da54785 (patch) | |
tree | 8ce5a4c4c637bab883ed7e6667bff7b5b74adbc3 /Source | |
parent | 876dde21d97897ad4ee98aa0d6b11898282982ce (diff) | |
download | sequelpro-3b251b8e3d4dc9a694ef76562b388ab07da54785.tar.gz sequelpro-3b251b8e3d4dc9a694ef76562b388ab07da54785.tar.bz2 sequelpro-3b251b8e3d4dc9a694ef76562b388ab07da54785.zip |
Replace some NSDictionaries with literals
* [NSDictionary dictionary] → @{}
* [NSDictionary dictionaryWithObject:forKey:] can safely be replaced. object==nil would have already thrown a NPE in the past.
* Also replaced some (hopefully safe) NSArray initializers (ie. their objects should always exist).
Diffstat (limited to 'Source')
45 files changed, 419 insertions, 447 deletions
diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m index ebbadd5a..1062f11d 100644 --- a/Source/GeneratePreviewForURL.m +++ b/Source/GeneratePreviewForURL.m @@ -495,7 +495,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, [imgProps setObject:image forKey:(NSString *)kQLPreviewPropertyAttachmentDataKey]; } - [props setObject:[NSDictionary dictionaryWithObject:imgProps forKey:@"icon.tiff"] forKey:(NSString *)kQLPreviewPropertyAttachmentsKey]; + [props setObject:@{@"icon.tiff" : imgProps} forKey:(NSString *) kQLPreviewPropertyAttachmentsKey]; [props setObject:@"UTF-8" forKey:(NSString *)kQLPreviewPropertyTextEncodingNameKey]; [props setObject:[NSNumber numberWithInt:NSUTF8StringEncoding] forKey:(NSString *)kQLPreviewPropertyStringEncodingKey]; [props setObject:@"text/html" forKey:(NSString *)kQLPreviewPropertyMIMETypeKey]; diff --git a/Source/MGTemplateEngine.m b/Source/MGTemplateEngine.m index 4a5d3192..4fe7620b 100644 --- a/Source/MGTemplateEngine.m +++ b/Source/MGTemplateEngine.m @@ -189,10 +189,9 @@ SEL selector = @selector(templateEngine:encounteredError:isContinuing:); if ([(NSObject *)delegate respondsToSelector:selector]) { - NSError *error = [NSError errorWithDomain:TEMPLATE_ENGINE_ERROR_DOMAIN - code:code - userInfo:[NSDictionary dictionaryWithObject:errStr - forKey:NSLocalizedDescriptionKey]]; + NSError *error = [NSError errorWithDomain:TEMPLATE_ENGINE_ERROR_DOMAIN + code:code + userInfo:@{NSLocalizedDescriptionKey : errStr}]; [(NSObject <MGTemplateEngineDelegate> *)delegate templateEngine:self encounteredError:error isContinuing:continuing]; diff --git a/Source/MGTemplateStandardFilters.m b/Source/MGTemplateStandardFilters.m index 3acc155e..f06ae752 100644 --- a/Source/MGTemplateStandardFilters.m +++ b/Source/MGTemplateStandardFilters.m @@ -16,10 +16,7 @@ - (NSArray *)filters { - return [NSArray arrayWithObjects: - UPPERCASE, LOWERCASE, CAPITALIZED, - DATE_FORMAT, COLOR_FORMAT, - nil]; + return @[UPPERCASE, LOWERCASE, CAPITALIZED, DATE_FORMAT, COLOR_FORMAT]; } - (NSObject *)filterInvoked:(NSString *)filter withArguments:(NSArray *)args onValue:(NSObject *)value diff --git a/Source/MGTemplateStandardMarkers.m b/Source/MGTemplateStandardMarkers.m index 543d16a7..5edcb00c 100644 --- a/Source/MGTemplateStandardMarkers.m +++ b/Source/MGTemplateStandardMarkers.m @@ -107,29 +107,20 @@ - (NSArray *)markers { - return [NSArray arrayWithObjects: - FOR_START, FOR_END, - SECTION_START, SECTION_END, - IF_START, ELSE, IF_END, - NOW, - COMMENT_START, COMMENT_END, - LOAD, - CYCLE, - SET, - nil]; + return @[FOR_START, FOR_END, SECTION_START, SECTION_END, IF_START, ELSE, IF_END, NOW, COMMENT_START, COMMENT_END, LOAD, CYCLE, SET]; } - (NSArray *)endMarkersForMarker:(NSString *)marker { if ([marker isEqualToString:FOR_START]) { - return [NSArray arrayWithObjects:FOR_END, nil]; + return @[FOR_END]; } else if ([marker isEqualToString:SECTION_START]) { - return [NSArray arrayWithObjects:SECTION_END, nil]; + return @[SECTION_END]; } else if ([marker isEqualToString:IF_START]) { - return [NSArray arrayWithObjects:IF_END, ELSE, nil]; + return @[IF_END, ELSE]; } else if ([marker isEqualToString:COMMENT_START]) { - return [NSArray arrayWithObjects:COMMENT_END, nil]; + return @[COMMENT_END]; } return nil; } @@ -531,8 +522,7 @@ } else if ([marker isEqualToString:SET]) { if (args && [args count] == 2 && *outputEnabled) { // Set variable arg1 to value arg2. - NSDictionary *newVar = [NSDictionary dictionaryWithObject:[args objectAtIndex:1] - forKey:[args objectAtIndex:0]]; + NSDictionary *newVar = @{[args objectAtIndex:0] : [args objectAtIndex:1]}; if (newVar) { *newVariables = newVar; } diff --git a/Source/SPActivityTextFieldCell.m b/Source/SPActivityTextFieldCell.m index 52b85bdd..5eb2deda 100644 --- a/Source/SPActivityTextFieldCell.m +++ b/Source/SPActivityTextFieldCell.m @@ -206,7 +206,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect) /** * Allow hit tracking for cancel functionality */ -- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView +- (NSCellHitResult)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView { return NSCellHitContentArea | NSCellHitTrackableArea; } diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 56da49cf..3f9db630 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -1821,10 +1821,12 @@ // For each scope add a submenu but not for the last one (should be General always) [menu addItem:[NSMenuItem separatorItem]]; [menu setAutoenablesItems:YES]; - NSArray *scopes = [NSArray arrayWithObjects:SPBundleScopeInputField, SPBundleScopeDataTable, SPBundleScopeGeneral, nil]; - NSArray *scopeTitles = [NSArray arrayWithObjects:NSLocalizedString(@"Input Field", @"input field menu item label"), - NSLocalizedString(@"Data Table", @"data table menu item label"), - NSLocalizedString(@"General", @"general menu item label"),nil]; + NSArray *scopes = @[SPBundleScopeInputField, SPBundleScopeDataTable, SPBundleScopeGeneral]; + NSArray *scopeTitles = @[ + NSLocalizedString(@"Input Field", @"input field menu item label"), + NSLocalizedString(@"Data Table", @"data table menu item label"), + NSLocalizedString(@"General", @"general menu item label") + ]; NSUInteger k = 0; BOOL bundleOtherThanGeneralFound = NO; @@ -2023,19 +2025,18 @@ */ - (NSMutableDictionary*)anonymizePreferencesForFeedbackReport:(NSMutableDictionary *)preferences { - [preferences removeObjectsForKeys: - [NSArray arrayWithObjects: - @"ContentFilters", - @"favorites", - @"lastSqlFileName", - @"NSNavLastRootDirectory", - @"openPath", - @"queryFavorites", - @"queryHistory", - @"tableColumnWidths", - @"savePath", - @"NSRecentDocumentRecords", - nil]]; + [preferences removeObjectsForKeys:@[ + @"ContentFilters", + @"favorites", + @"lastSqlFileName", + @"NSNavLastRootDirectory", + @"openPath", + @"queryFavorites", + @"queryHistory", + @"tableColumnWidths", + @"savePath", + @"NSRecentDocumentRecords" + ]]; return preferences; } diff --git a/Source/SPBundleCommandRunner.m b/Source/SPBundleCommandRunner.m index b8e22b93..45184618 100644 --- a/Source/SPBundleCommandRunner.m +++ b/Source/SPBundleCommandRunner.m @@ -219,7 +219,7 @@ // register command pid = [bashTask processIdentifier]; NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:pid], @"pid", - (contextInfo)?:[NSDictionary dictionary], @"contextInfo", + (contextInfo)?: @{}, @"contextInfo", @"bashcommand", @"type", [[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]], @"starttime", nil]; diff --git a/Source/SPBundleCommandTextView.m b/Source/SPBundleCommandTextView.m index 4ca63451..9a2d2ba8 100644 --- a/Source/SPBundleCommandTextView.m +++ b/Source/SPBundleCommandTextView.m @@ -377,7 +377,7 @@ NSInteger tabStopWidth = [prefs integerForKey:SPCustomQueryEditorTabStopWidth]; if(tabStopWidth < 1) tabStopWidth = 1; - float tabWidth = NSSizeToCGSize([@" " sizeWithAttributes:[NSDictionary dictionaryWithObject:tvFont forKey:NSFontAttributeName]]).width; + float tabWidth = NSSizeToCGSize([@" " sizeWithAttributes:@{NSFontAttributeName : tvFont}]).width; tabWidth = (float)tabStopWidth * tabWidth; NSInteger numberOfTabs = 256/tabStopWidth; diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m index 4de339de..cb4ccf88 100644 --- a/Source/SPBundleEditorController.m +++ b/Source/SPBundleEditorController.m @@ -130,17 +130,17 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; triggerGeneralPopUpMenu = [[NSMenu alloc] initWithTitle:@""]; withBlobDataTablePopUpMenu = [[NSMenu alloc] initWithTitle:@""]; - inputGeneralScopeArray = [[NSArray arrayWithObjects:SPBundleInputSourceNone, nil] retain]; - inputInputFieldScopeArray = [[NSArray arrayWithObjects:SPBundleInputSourceNone, SPBundleInputSourceSelectedText, SPBundleInputSourceEntireContent, nil] retain]; - inputDataTableScopeArray = [[NSArray arrayWithObjects:SPBundleInputSourceNone, SPBundleInputSourceSelectedTableRowsAsTab, SPBundleInputSourceSelectedTableRowsAsCsv, SPBundleInputSourceSelectedTableRowsAsSqlInsert, SPBundleInputSourceTableRowsAsTab, SPBundleInputSourceTableRowsAsCsv, SPBundleInputSourceTableRowsAsSqlInsert, nil] retain]; - outputInputFieldScopeArray = [[NSArray arrayWithObjects:SPBundleOutputActionNone, SPBundleOutputActionInsertAsText, SPBundleOutputActionInsertAsSnippet, SPBundleOutputActionReplaceSelection, SPBundleOutputActionReplaceContent, SPBundleOutputActionShowAsTextTooltip, SPBundleOutputActionShowAsHTMLTooltip, SPBundleOutputActionShowAsHTML, nil] retain]; - outputGeneralScopeArray = [[NSArray arrayWithObjects:SPBundleOutputActionNone, SPBundleOutputActionShowAsTextTooltip, SPBundleOutputActionShowAsHTMLTooltip, SPBundleOutputActionShowAsHTML, nil] retain]; - outputDataTableScopeArray = [[NSArray arrayWithObjects:SPBundleOutputActionNone, SPBundleOutputActionShowAsTextTooltip, SPBundleOutputActionShowAsHTMLTooltip, SPBundleOutputActionShowAsHTML, nil] retain]; - inputFallbackInputFieldScopeArray = [[NSArray arrayWithObjects:SPBundleInputSourceNone, SPBundleInputSourceCurrentWord, SPBundleInputSourceCurrentLine, SPBundleInputSourceCurrentQuery, SPBundleInputSourceEntireContent, nil] retain]; - triggerInputFieldArray = [[NSArray arrayWithObjects:SPBundleTriggerActionNone, nil] retain]; - triggerDataTableArray = [[NSArray arrayWithObjects:SPBundleTriggerActionNone, SPBundleTriggerActionDatabaseChanged, SPBundleTriggerActionTableChanged, SPBundleTriggerActionTableRowChanged, nil] retain]; - triggerGeneralArray = [[NSArray arrayWithObjects:SPBundleTriggerActionNone, SPBundleTriggerActionDatabaseChanged, SPBundleTriggerActionTableChanged, nil] retain]; - withBlobDataTableArray = [[NSArray arrayWithObjects:SPBundleInputSourceBlobHandlingExclude, SPBundleInputSourceBlobHandlingInclude, SPBundleInputSourceBlobHandlingImageFileReference, SPBundleInputSourceBlobHandlingFileReference, nil] retain]; + inputGeneralScopeArray = [@[SPBundleInputSourceNone] retain]; + inputInputFieldScopeArray = [@[SPBundleInputSourceNone, SPBundleInputSourceSelectedText, SPBundleInputSourceEntireContent] retain]; + inputDataTableScopeArray = [@[SPBundleInputSourceNone, SPBundleInputSourceSelectedTableRowsAsTab, SPBundleInputSourceSelectedTableRowsAsCsv, SPBundleInputSourceSelectedTableRowsAsSqlInsert, SPBundleInputSourceTableRowsAsTab, SPBundleInputSourceTableRowsAsCsv, SPBundleInputSourceTableRowsAsSqlInsert] retain]; + outputInputFieldScopeArray = [@[SPBundleOutputActionNone, SPBundleOutputActionInsertAsText, SPBundleOutputActionInsertAsSnippet, SPBundleOutputActionReplaceSelection, SPBundleOutputActionReplaceContent, SPBundleOutputActionShowAsTextTooltip, SPBundleOutputActionShowAsHTMLTooltip, SPBundleOutputActionShowAsHTML] retain]; + outputGeneralScopeArray = [@[SPBundleOutputActionNone, SPBundleOutputActionShowAsTextTooltip, SPBundleOutputActionShowAsHTMLTooltip, SPBundleOutputActionShowAsHTML] retain]; + outputDataTableScopeArray = [@[SPBundleOutputActionNone, SPBundleOutputActionShowAsTextTooltip, SPBundleOutputActionShowAsHTMLTooltip, SPBundleOutputActionShowAsHTML] retain]; + inputFallbackInputFieldScopeArray = [@[SPBundleInputSourceNone, SPBundleInputSourceCurrentWord, SPBundleInputSourceCurrentLine, SPBundleInputSourceCurrentQuery, SPBundleInputSourceEntireContent] retain]; + triggerInputFieldArray = [@[SPBundleTriggerActionNone] retain]; + triggerDataTableArray = [@[SPBundleTriggerActionNone, SPBundleTriggerActionDatabaseChanged, SPBundleTriggerActionTableChanged, SPBundleTriggerActionTableRowChanged] retain]; + triggerGeneralArray = [@[SPBundleTriggerActionNone, SPBundleTriggerActionDatabaseChanged, SPBundleTriggerActionTableChanged] retain]; + withBlobDataTableArray = [@[SPBundleInputSourceBlobHandlingExclude, SPBundleInputSourceBlobHandlingInclude, SPBundleInputSourceBlobHandlingImageFileReference, SPBundleInputSourceBlobHandlingFileReference] retain]; NSMutableArray *allPopupScopeItems = [NSMutableArray array]; [allPopupScopeItems addObjectsFromArray:inputGeneralScopeArray]; @@ -155,65 +155,65 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; [allPopupScopeItems addObjectsFromArray:triggerGeneralArray]; [allPopupScopeItems addObjectsFromArray:withBlobDataTableArray]; - NSDictionary *menuItemTitles = [NSDictionary dictionaryWithObjects: - [NSArray arrayWithObjects: - NSLocalizedString(@"None", @"Bundle Editor : Scope=General : Input source dropdown: 'None' item"), - - NSLocalizedString(@"None", @"Bundle Editor : Scope=Field : Input source dropdown: 'None' item"), - NSLocalizedString(@"Selected Text", @"Bundle Editor : Scope=Field : Input source dropdown: 'selected text' item"), - NSLocalizedString(@"Entire Content", @"Bundle Editor : Scope=Field : Input source dropdown: 'entire content' item"), - - NSLocalizedString(@"None", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'none' item"), - NSLocalizedString(@"Selected Rows (TSV)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'selected rows as tab-separated' item"), - NSLocalizedString(@"Selected Rows (CSV)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'selected rows as comma-separated' item"), - NSLocalizedString(@"Selected Rows (SQL)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'selected rows as SQL' item"), - NSLocalizedString(@"Table Content (TSV)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'table content as tab-separated' item"), - NSLocalizedString(@"Table Content (CSV)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'table content as comma-separated' item"), - NSLocalizedString(@"Table Content (SQL)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'table content as SQL' item"), - - NSLocalizedString(@"None", @"Bundle Editor : Scope=Field : Output dropdown : 'none' item"), - NSLocalizedString(@"Insert as Text", @"Bundle Editor : Scope=Field : Output dropdown : 'insert as text' item"), - NSLocalizedString(@"Insert as Snippet", @"Bundle Editor : Scope=Field : Output dropdown : 'insert as snippet' item"), - NSLocalizedString(@"Replace Selection", @"Bundle Editor : Scope=Field : Output dropdown : 'replace selection' item"), - NSLocalizedString(@"Replace Entire Content", @"Bundle Editor : Scope=Field : Output dropdown : 'replace entire content' item"), - NSLocalizedString(@"Show as Text Tooltip", @"Bundle Editor : Scope=Field : Output dropdown : 'show as text tooltip' item"), - NSLocalizedString(@"Show as HTML Tooltip", @"Bundle Editor : Scope=Field : Output dropdown : 'show as html tooltip' item"), - NSLocalizedString(@"Show as HTML", @"Bundle Editor : Scope=Field : Output dropdown : 'show as html' item"), - - NSLocalizedString(@"None", @"Bundle Editor : Scope=General : Output dropdown : 'none' item"), - NSLocalizedString(@"Show as Text Tooltip", @"Bundle Editor : Scope=General : Output dropdown : 'show as text tooltip' item"), - NSLocalizedString(@"Show as HTML Tooltip", @"Bundle Editor : Scope=General : Output dropdown : 'show as html tooltip' item"), - NSLocalizedString(@"Show as HTML", @"Bundle Editor : Scope=General : Output dropdown : 'show as html' item"), - - NSLocalizedString(@"None", @"Bundle Editor : Scope=Data-Table : Output dropdown : 'none' item"), - NSLocalizedString(@"Show as Text Tooltip", @"Bundle Editor : Scope=Data-Table : Output dropdown : 'show as text tooltip' item"), - NSLocalizedString(@"Show as HTML Tooltip", @"Bundle Editor : Scope=Data-Table : Output dropdown : 'show as html tooltip' item"), - NSLocalizedString(@"Show as HTML", @"Bundle Editor : Scope=Data-Table : Output dropdown : 'show as html' item"), - - NSLocalizedString(@"None", @"Bundle Editor : Fallback Input source dropdown : 'none' item"), - NSLocalizedString(@"Current Word", @"Bundle Editor : Fallback Input source dropdown : 'current word' item"), - NSLocalizedString(@"Current Line", @"Bundle Editor : Fallback Input source dropdown : 'current line' item"), - NSLocalizedString(@"Current Query", @"Bundle Editor : Fallback Input source dropdown : 'current query' item"), - NSLocalizedString(@"Entire Content", @"Bundle Editor : Fallback Input source dropdown : 'entire content' item"), - - NSLocalizedString(@"None", @"Bundle Editor : Scope=Field : Trigger dropdown : 'none' item"), - - NSLocalizedString(@"None", @"Bundle Editor : Scope=Data-Table : Trigger dropdown : 'none' item"), - NSLocalizedString(@"Database changed", @"Bundle Editor : Scope=Data-Table : Trigger dropdown : 'database changed' item"), - NSLocalizedString(@"Table changed", @"Bundle Editor : Scope=Data-Table : Trigger dropdown : 'table changed' item"), - NSLocalizedString(@"Table Row changed", @"Bundle Editor : Scope=Data-Table : Trigger dropdown : 'table row changed' item"), - - NSLocalizedString(@"None", @"Bundle Editor : Scope=General : Trigger dropdown : 'none' item"), - NSLocalizedString(@"Database changed", @"Bundle Editor : Scope=General : Trigger dropdown : 'database changed' item"), - NSLocalizedString(@"Table changed", @"Bundle Editor : Scope=General : Trigger dropdown : 'table changed' item"), - - NSLocalizedString(@"exclude BLOB", @"Bundle Editor : BLOB dropdown : 'exclude BLOB' item"), - NSLocalizedString(@"include BLOB", @"Bundle Editor : BLOB dropdown : 'include BLOB' item"), - NSLocalizedString(@"save BLOB as image file", @"Bundle Editor : BLOB dropdown : 'save BLOB as image file' item"), - NSLocalizedString(@"save BLOB as dat file", @"Bundle Editor : BLOB dropdown : 'save BLOB as dat file' item"), - - nil] - forKeys:allPopupScopeItems]; + NSDictionary *menuItemTitles = @{ + allPopupScopeItems : @[ + NSLocalizedString(@"None", @"Bundle Editor : Scope=General : Input source dropdown: 'None' item"), + + NSLocalizedString(@"None", @"Bundle Editor : Scope=Field : Input source dropdown: 'None' item"), + NSLocalizedString(@"Selected Text", @"Bundle Editor : Scope=Field : Input source dropdown: 'selected text' item"), + NSLocalizedString(@"Entire Content", @"Bundle Editor : Scope=Field : Input source dropdown: 'entire content' item"), + + NSLocalizedString(@"None", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'none' item"), + NSLocalizedString(@"Selected Rows (TSV)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'selected rows as tab-separated' item"), + NSLocalizedString(@"Selected Rows (CSV)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'selected rows as comma-separated' item"), + NSLocalizedString(@"Selected Rows (SQL)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'selected rows as SQL' item"), + NSLocalizedString(@"Table Content (TSV)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'table content as tab-separated' item"), + NSLocalizedString(@"Table Content (CSV)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'table content as comma-separated' item"), + NSLocalizedString(@"Table Content (SQL)", @"Bundle Editor : Scope=Data-Table : Input source dropdown: 'table content as SQL' item"), + + NSLocalizedString(@"None", @"Bundle Editor : Scope=Field : Output dropdown : 'none' item"), + NSLocalizedString(@"Insert as Text", @"Bundle Editor : Scope=Field : Output dropdown : 'insert as text' item"), + NSLocalizedString(@"Insert as Snippet", @"Bundle Editor : Scope=Field : Output dropdown : 'insert as snippet' item"), + NSLocalizedString(@"Replace Selection", @"Bundle Editor : Scope=Field : Output dropdown : 'replace selection' item"), + NSLocalizedString(@"Replace Entire Content", @"Bundle Editor : Scope=Field : Output dropdown : 'replace entire content' item"), + NSLocalizedString(@"Show as Text Tooltip", @"Bundle Editor : Scope=Field : Output dropdown : 'show as text tooltip' item"), + NSLocalizedString(@"Show as HTML Tooltip", @"Bundle Editor : Scope=Field : Output dropdown : 'show as html tooltip' item"), + NSLocalizedString(@"Show as HTML", @"Bundle Editor : Scope=Field : Output dropdown : 'show as html' item"), + + NSLocalizedString(@"None", @"Bundle Editor : Scope=General : Output dropdown : 'none' item"), + NSLocalizedString(@"Show as Text Tooltip", @"Bundle Editor : Scope=General : Output dropdown : 'show as text tooltip' item"), + NSLocalizedString(@"Show as HTML Tooltip", @"Bundle Editor : Scope=General : Output dropdown : 'show as html tooltip' item"), + NSLocalizedString(@"Show as HTML", @"Bundle Editor : Scope=General : Output dropdown : 'show as html' item"), + + NSLocalizedString(@"None", @"Bundle Editor : Scope=Data-Table : Output dropdown : 'none' item"), + NSLocalizedString(@"Show as Text Tooltip", @"Bundle Editor : Scope=Data-Table : Output dropdown : 'show as text tooltip' item"), + NSLocalizedString(@"Show as HTML Tooltip", @"Bundle Editor : Scope=Data-Table : Output dropdown : 'show as html tooltip' item"), + NSLocalizedString(@"Show as HTML", @"Bundle Editor : Scope=Data-Table : Output dropdown : 'show as html' item"), + + NSLocalizedString(@"None", @"Bundle Editor : Fallback Input source dropdown : 'none' item"), + NSLocalizedString(@"Current Word", @"Bundle Editor : Fallback Input source dropdown : 'current word' item"), + NSLocalizedString(@"Current Line", @"Bundle Editor : Fallback Input source dropdown : 'current line' item"), + NSLocalizedString(@"Current Query", @"Bundle Editor : Fallback Input source dropdown : 'current query' item"), + NSLocalizedString(@"Entire Content", @"Bundle Editor : Fallback Input source dropdown : 'entire content' item"), + + NSLocalizedString(@"None", @"Bundle Editor : Scope=Field : Trigger dropdown : 'none' item"), + + NSLocalizedString(@"None", @"Bundle Editor : Scope=Data-Table : Trigger dropdown : 'none' item"), + NSLocalizedString(@"Database changed", @"Bundle Editor : Scope=Data-Table : Trigger dropdown : 'database changed' item"), + NSLocalizedString(@"Table changed", @"Bundle Editor : Scope=Data-Table : Trigger dropdown : 'table changed' item"), + NSLocalizedString(@"Table Row changed", @"Bundle Editor : Scope=Data-Table : Trigger dropdown : 'table row changed' item"), + + NSLocalizedString(@"None", @"Bundle Editor : Scope=General : Trigger dropdown : 'none' item"), + NSLocalizedString(@"Database changed", @"Bundle Editor : Scope=General : Trigger dropdown : 'database changed' item"), + NSLocalizedString(@"Table changed", @"Bundle Editor : Scope=General : Trigger dropdown : 'table changed' item"), + + NSLocalizedString(@"exclude BLOB", @"Bundle Editor : BLOB dropdown : 'exclude BLOB' item"), + NSLocalizedString(@"include BLOB", @"Bundle Editor : BLOB dropdown : 'include BLOB' item"), + NSLocalizedString(@"save BLOB as image file", @"Bundle Editor : BLOB dropdown : 'save BLOB as image file' item"), + NSLocalizedString(@"save BLOB as dat file", @"Bundle Editor : BLOB dropdown : 'save BLOB as dat file' item"), + + ] + }; NSMenuItem *anItem; for(NSString* title in inputGeneralScopeArray) { @@ -294,52 +294,51 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; [commandBundleTreeController setSortDescriptors:[NSArray arrayWithObjects:sortDescriptor, nil]]; - shellVariableSuggestions = [[NSArray arrayWithObjects: - SPBundleShellVariableAllDatabases, - SPBundleShellVariableAllFunctions, - SPBundleShellVariableAllProcedures, - SPBundleShellVariableAllTables, - SPBundleShellVariableAllViews, - SPBundleShellVariableAppResourcesDirectory, - SPBundleShellVariableBlobFileDirectory, - SPBundleShellVariableExitInsertAsSnippet, - SPBundleShellVariableExitInsertAsText, - SPBundleShellVariableExitNone, - SPBundleShellVariableExitReplaceContent, - SPBundleShellVariableExitReplaceSelection, - SPBundleShellVariableExitShowAsHTML, - SPBundleShellVariableExitShowAsHTMLTooltip, - SPBundleShellVariableExitShowAsTextTooltip, - SPBundleShellVariableInputFilePath, - SPBundleShellVariableInputTableMetaData, - SPBundleShellVariableBundlePath, - SPBundleShellVariableBundleScope, - SPBundleShellVariableCurrentEditedColumnName, - SPBundleShellVariableCurrentEditedTable, - SPBundleShellVariableCurrentHost, - SPBundleShellVariableCurrentLine, - SPBundleShellVariableCurrentPort, - SPBundleShellVariableCurrentQuery, - SPBundleShellVariableCurrentUser, - SPBundleShellVariableCurrentWord, - SPBundleShellVariableDataTableSource, - SPBundleShellVariableDatabaseEncoding, - SPBundleShellVariableIconFile, - SPBundleShellVariableProcessID, - SPBundleShellVariableQueryFile, - SPBundleShellVariableQueryResultFile, - SPBundleShellVariableQueryResultMetaFile, - SPBundleShellVariableQueryResultStatusFile, - SPBundleShellVariableRDBMSType, - SPBundleShellVariableRDBMSVersion, - SPBundleShellVariableSelectedDatabase, - SPBundleShellVariableSelectedRowIndices, - SPBundleShellVariableSelectedTable, - SPBundleShellVariableSelectedTables, - SPBundleShellVariableSelectedText, - SPBundleShellVariableSelectedTextRange, - SPBundleShellVariableUsedQueryForTable, - nil + shellVariableSuggestions = [@[ + SPBundleShellVariableAllDatabases, + SPBundleShellVariableAllFunctions, + SPBundleShellVariableAllProcedures, + SPBundleShellVariableAllTables, + SPBundleShellVariableAllViews, + SPBundleShellVariableAppResourcesDirectory, + SPBundleShellVariableBlobFileDirectory, + SPBundleShellVariableExitInsertAsSnippet, + SPBundleShellVariableExitInsertAsText, + SPBundleShellVariableExitNone, + SPBundleShellVariableExitReplaceContent, + SPBundleShellVariableExitReplaceSelection, + SPBundleShellVariableExitShowAsHTML, + SPBundleShellVariableExitShowAsHTMLTooltip, + SPBundleShellVariableExitShowAsTextTooltip, + SPBundleShellVariableInputFilePath, + SPBundleShellVariableInputTableMetaData, + SPBundleShellVariableBundlePath, + SPBundleShellVariableBundleScope, + SPBundleShellVariableCurrentEditedColumnName, + SPBundleShellVariableCurrentEditedTable, + SPBundleShellVariableCurrentHost, + SPBundleShellVariableCurrentLine, + SPBundleShellVariableCurrentPort, + SPBundleShellVariableCurrentQuery, + SPBundleShellVariableCurrentUser, + SPBundleShellVariableCurrentWord, + SPBundleShellVariableDataTableSource, + SPBundleShellVariableDatabaseEncoding, + SPBundleShellVariableIconFile, + SPBundleShellVariableProcessID, + SPBundleShellVariableQueryFile, + SPBundleShellVariableQueryResultFile, + SPBundleShellVariableQueryResultMetaFile, + SPBundleShellVariableQueryResultStatusFile, + SPBundleShellVariableRDBMSType, + SPBundleShellVariableRDBMSVersion, + SPBundleShellVariableSelectedDatabase, + SPBundleShellVariableSelectedRowIndices, + SPBundleShellVariableSelectedTable, + SPBundleShellVariableSelectedTables, + SPBundleShellVariableSelectedText, + SPBundleShellVariableSelectedTextRange, + SPBundleShellVariableUsedQueryForTable ] retain]; if([[NSUserDefaults standardUserDefaults] objectForKey:SPBundleDeletedDefaultBundlesKey]) { @@ -348,7 +347,7 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; [self _initTree]; -} +}; #pragma mark - @@ -675,7 +674,7 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; if(category == nil) category = @""; bundle = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:NSLocalizedString(@"New Bundle",@"Bundle Editor : Default name for new bundle in the list on the left"), NSLocalizedString(@"New Name",@"Bundle Editor : Default name for a new bundle in the menu"), @"", scope, category, newUUID, nil] - forKeys:[NSArray arrayWithObjects:kBundleNameKey, SPBundleFileNameKey, SPBundleFileCommandKey, SPBundleFileScopeKey, SPBundleFileCategoryKey, SPBundleFileUUIDKey, nil]]; + forKeys:@[kBundleNameKey, SPBundleFileNameKey, SPBundleFileCommandKey, SPBundleFileScopeKey, SPBundleFileCategoryKey, SPBundleFileUUIDKey]]; } if(![touchedBundleArray containsObject:[bundle objectForKey:kBundleNameKey]]) @@ -929,9 +928,7 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; [saveDict setObject:[[saveDict objectForKey:SPBundleFileContactKey] rot13] forKey:SPBundleFileContactKey]; // Remove unnecessary keys - [saveDict removeObjectsForKeys:[NSArray arrayWithObjects: - kBundleNameKey, - nil]]; + [saveDict removeObjectsForKeys:@[kBundleNameKey]]; if(!isNewBundle) { @@ -1493,7 +1490,7 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; /** * Allow for drag-n-drop out of the application as a copy */ -- (NSUInteger)draggingSourceOperationMaskForLocal:(BOOL)isLocal +- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal { return NSDragOperationMove; } diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index e98cc426..e9d9272c 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -779,7 +779,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, { NSNumber *favoriteID = [self _createNewFavoriteID]; - NSArray *objects = [NSArray arrayWithObjects: + NSArray *objects = @[ NSLocalizedString(@"New Favorite", @"new favorite name"), @0, @"", @@ -787,20 +787,20 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, @"", @(-1), @"", - [NSNumber numberWithInt:NSOffState], - [NSNumber numberWithInt:NSOffState], - [NSNumber numberWithInt:NSOffState], - [NSNumber numberWithInt:NSOffState], + @(NSOffState), + @(NSOffState), + @(NSOffState), + @(NSOffState), @"", @"", @"", - [NSNumber numberWithInt:NSOffState], + @(NSOffState), @"", @"", - favoriteID, - nil]; + favoriteID + ]; - NSArray *keys = [NSArray arrayWithObjects: + NSArray *keys = @[ SPFavoriteNameKey, SPFavoriteTypeKey, SPFavoriteHostKey, @@ -818,8 +818,8 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, SPFavoriteSSHKeyLocationEnabledKey, SPFavoriteSSHKeyLocationKey, SPFavoriteSSHPortKey, - SPFavoriteIDKey, - nil]; + SPFavoriteIDKey + ]; // Create default favorite NSMutableDictionary *favorite = [NSMutableDictionary dictionaryWithObjects:objects forKeys:keys]; diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index d6fed676..e35fd672 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -89,12 +89,12 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; [contentFilterSplitView setMaxSize:245.f ofSubviewAtIndex:0]; // Add global group row to contentFilters - [contentFilters addObject:[NSDictionary dictionaryWithObjectsAndKeys: - NSLocalizedString(@"Global",@"Content Filter Manager : Filter Entry List: 'Global' Header"), @"MenuLabel", - @"", @"headerOfFileURL", - @"", @"Clause", - @"", @"ConjunctionLabel", - nil]]; + [contentFilters addObject:@{ + @"MenuLabel" : NSLocalizedString(@"Global", @"Content Filter Manager : Filter Entry List: 'Global' Header"), + @"headerOfFileURL" : @"", + @"Clause" : @"", + @"ConjunctionLabel" : @"" + }]; #ifndef SP_CODA /* prefs access */ // Build data source for global content filter (as mutable copy! otherwise each @@ -240,10 +240,10 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; // Duplicate a selected filter if sender == self if(sender == self) - filter = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSString stringWithFormat:NSLocalizedString(@"%@ Copy",@"Content Filter Manager : Initial name of copied filter"),[contentFilterNameTextField stringValue]], [contentFilterTextView string], nil] forKeys:[NSArray arrayWithObjects:@"MenuLabel", @"Clause", nil]]; + filter = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSString stringWithFormat:NSLocalizedString(@"%@ Copy",@"Content Filter Manager : Initial name of copied filter"),[contentFilterNameTextField stringValue]], [contentFilterTextView string], nil] forKeys:@[@"MenuLabel", @"Clause"]]; // Add a new filter else - filter = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:NSLocalizedString(@"New Filter",@"Content Filter Manager : Initial name for new filter"), @"", @"", nil] forKeys:[NSArray arrayWithObjects:@"MenuLabel", @"Clause", @"ConjunctionLabel", nil]]; + filter = [NSMutableDictionary dictionaryWithObjects:@[NSLocalizedString(@"New Filter",@"Content Filter Manager : Initial name for new filter"), @"", @""] forKeys:@[@"MenuLabel", @"Clause", @"ConjunctionLabel"]]; // If a favourite is currently selected, add the new favourite next to it if([contentFilterTableView numberOfSelectedRows] > 0) { diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 7796ca11..3efc132a 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -108,7 +108,7 @@ static const NSInteger kBlobAsImageFile = 4; if (tmp != nil){ NSPasteboard *pb = [NSPasteboard generalPasteboard]; - [pb declareTypes:[NSArray arrayWithObjects: NSStringPboardType, nil] owner:nil]; + [pb declareTypes:@[NSStringPboardType] owner:nil]; [pb setString:tmp forType:NSStringPboardType]; } @@ -119,7 +119,7 @@ static const NSInteger kBlobAsImageFile = 4; if (tmp != nil) { NSPasteboard *pb = [NSPasteboard generalPasteboard]; - [pb declareTypes:[NSArray arrayWithObjects:NSTabularTextPboardType, NSStringPboardType, nil] owner:nil]; + [pb declareTypes:@[NSTabularTextPboardType, NSStringPboardType] owner:nil]; [pb setString:tmp forType:NSStringPboardType]; [pb setString:tmp forType:NSTabularTextPboardType]; @@ -781,7 +781,7 @@ static const NSInteger kBlobAsImageFile = 4; NSFont *tableFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; #endif NSUInteger columnIndex = (NSUInteger)[[columnDefinition objectForKey:@"datacolumnindex"] integerValue]; - NSDictionary *stringAttributes = [NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]; + NSDictionary *stringAttributes = @{NSFontAttributeName : tableFont}; Class spmysqlGeometryData = [SPMySQLGeometryData class]; // Check the number of rows available to check, sampling every n rows @@ -870,7 +870,7 @@ static const NSInteger kBlobAsImageFile = 4; maxCellWidth += columnBaseWidth; // If the header width is wider than this expanded width, use it instead - cellWidth = [[columnDefinition objectForKey:@"name"] sizeWithAttributes:[NSDictionary dictionaryWithObject:[NSFont labelFontOfSize:[NSFont smallSystemFontSize]] forKey:NSFontAttributeName]].width; + cellWidth = [[columnDefinition objectForKey:@"name"] sizeWithAttributes:@{NSFontAttributeName : [NSFont labelFontOfSize:[NSFont smallSystemFontSize]]}].width; if (cellWidth + 10 > maxCellWidth) maxCellWidth = cellWidth + 10; return maxCellWidth; diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 21ce6970..94d1b355 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -1664,7 +1664,7 @@ #else NSFont *tableFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; #endif - [customQueryView setRowHeight:2.0f+NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; + [customQueryView setRowHeight:2.0f+NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:@{NSFontAttributeName : tableFont}]).height]; // If there are no table columns to add, return if (!cqColumnDefinition || ![cqColumnDefinition count]) return; @@ -1808,7 +1808,7 @@ NSDictionary *columnDefinition = [NSDictionary dictionaryWithDictionary:[cqColumnDefinition objectAtIndex:[[[[customQueryView tableColumns] objectAtIndex:columnIndex] identifier] integerValue]]]; if(!columnDefinition) - return [NSArray arrayWithObjects:@(-2), @"", nil]; + return @[@(-2), @""]; // Resolve the original table name for current column if AS was used NSString *tableForColumn = [columnDefinition objectForKey:@"org_table"]; @@ -1819,13 +1819,13 @@ // No table/database name found indicates that the field's column contains data from more than one table as for UNION // or the field data are not bound to any table as in SELECT 1 or if column database is unset if(!tableForColumn || ![tableForColumn length] || !dbForColumn || ![dbForColumn length]) - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; // if table and database name are given check if field can be identified unambiguously // first without blob data NSString *fieldIDQueryStr = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"] includeBlobs:NO]; if(!fieldIDQueryStr) - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; [tableDocumentInstance startTaskWithDescription:NSLocalizedString(@"Checking field data for editing...", @"checking field data for editing task description")]; @@ -1837,7 +1837,7 @@ if ([mySQLConnection queryErrored]) { [tableDocumentInstance endTask]; - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; } NSArray *tempRow = [tempResult getRowAsArray]; @@ -1847,7 +1847,7 @@ fieldIDQueryStr = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"] includeBlobs:YES]; if(!fieldIDQueryStr) { [tableDocumentInstance endTask]; - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; } tempResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@.%@ %@", @@ -1857,14 +1857,14 @@ if ([mySQLConnection queryErrored]) { [tableDocumentInstance endTask]; - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; } tempRow = [tempResult getRowAsArray]; if([tempRow count] && [[tempRow objectAtIndex:0] integerValue] < 1) { [tableDocumentInstance endTask]; - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; } } @@ -2290,9 +2290,7 @@ NSString *tmp = [customQueryView draggedRowsAsTabString]; if ( nil != tmp ) { - [pboard declareTypes:[NSArray arrayWithObjects: NSTabularTextPboardType, - NSStringPboardType, nil] - owner:nil]; + [pboard declareTypes:@[NSTabularTextPboardType, NSStringPboardType] owner:nil]; [pboard setString:tmp forType:NSStringPboardType]; [pboard setString:tmp forType:NSTabularTextPboardType]; return YES; @@ -3394,7 +3392,7 @@ NSMutableParagraphStyle *paraStyle = [[[NSMutableParagraphStyle alloc] init] autorelease]; [paraStyle setTabStops:@[]]; [paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0f] autorelease]]; - NSDictionary *attributes = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:paraStyle, [NSFont systemFontOfSize:11], nil] forKeys:[NSArray arrayWithObjects:NSParagraphStyleAttributeName, NSFontAttributeName, nil]]; + NSDictionary *attributes = @{NSParagraphStyleAttributeName : paraStyle, NSFontAttributeName : [NSFont systemFontOfSize:11]}; NSAttributedString *titleString = [[[NSAttributedString alloc] initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@⇥", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"] attributes:attributes] autorelease]; @@ -3420,7 +3418,7 @@ NSMutableParagraphStyle *paraStyle = [[[NSMutableParagraphStyle alloc] init] autorelease]; [paraStyle setTabStops:@[]]; [paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0f] autorelease]]; - NSDictionary *attributes = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:paraStyle, [NSFont systemFontOfSize:11], nil] forKeys:[NSArray arrayWithObjects:NSParagraphStyleAttributeName, NSFontAttributeName, nil]]; + NSDictionary *attributes = @{NSParagraphStyleAttributeName : paraStyle, NSFontAttributeName : [NSFont systemFontOfSize:11]}; NSAttributedString *titleString = [[[NSAttributedString alloc] initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@⇥", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"] attributes:attributes] autorelease]; @@ -3540,11 +3538,7 @@ // Result Table Font preference changed else if ([keyPath isEqualToString:SPGlobalResultTableFont]) { NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]; -#ifndef SP_CODA - [customQueryView setRowHeight:2.0f+NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; -#else - [customQueryView setRowHeight:2.0f+NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; -#endif + [customQueryView setRowHeight:2.0f+NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:@{NSFontAttributeName : tableFont}]).height]; [customQueryView setFont:tableFont]; [customQueryView reloadData]; } @@ -3596,13 +3590,13 @@ if([saveQueryFavoriteGlobal state] == NSOnState) { [favorites addObject:[NSMutableDictionary dictionaryWithObjects: [NSArray arrayWithObjects:[queryFavoriteNameTextField stringValue], queryToBeAddded, nil] - forKeys:[NSArray arrayWithObjects:@"name", @"query", nil]]]; + forKeys:@[@"name", @"query"]]]; [prefs setObject:favorites forKey:SPQueryFavorites]; } else { [[SPQueryController sharedQueryController] addFavorite:[NSMutableDictionary dictionaryWithObjects: [NSArray arrayWithObjects:[queryFavoriteNameTextField stringValue], [[queryToBeAddded mutableCopy] autorelease], nil] - forKeys:[NSArray arrayWithObjects:@"name", @"query", nil]] forFileURL:[tableDocumentInstance fileURL]]; + forKeys:@[@"name", @"query"]] forFileURL:[tableDocumentInstance fileURL]]; } [saveQueryFavoriteGlobal setState:NSOffState]; diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m index ed17a506..b0355b05 100644 --- a/Source/SPDataImport.m +++ b/Source/SPDataImport.m @@ -662,7 +662,7 @@ [tablesListInstance updateTables:self]; // Re-query the structure of all databases in the background - [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", nil]]; + [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; // Import finished Growl notification [[SPGrowlController sharedGrowlController] notifyWithTitle:@"Import Finished" @@ -1178,7 +1178,7 @@ [tablesListInstance performSelectorOnMainThread:@selector(updateTables:) withObject:self waitUntilDone:YES]; // Re-query the structure of all databases in the background - [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", nil]]; + [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; // Select the new table [tablesListInstance selectItemWithName:selectedTableTarget]; diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m index 1bd9a8f9..58ffa2d2 100644 --- a/Source/SPDatabaseData.m +++ b/Source/SPDatabaseData.m @@ -167,7 +167,7 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, NSString *charSet = [NSString stringWithCString:c->name encoding:NSUTF8StringEncoding]; if ([charSet isEqualToString:characterSetEncoding]) { - [characterSetCollations addObject:[NSDictionary dictionaryWithObject:[NSString stringWithCString:c->collation encoding:NSUTF8StringEncoding] forKey:@"COLLATION_NAME"]]; + [characterSetCollations addObject:@{@"COLLATION_NAME" : [NSString stringWithCString:c->collation encoding:NSUTF8StringEncoding]}]; } ++c; @@ -191,36 +191,36 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, { if ([storageEngines count] == 0) { if ([serverSupport isMySQL3] || [serverSupport isMySQL4]) { - [storageEngines addObject:[NSDictionary dictionaryWithObject:@"MyISAM" forKey:@"Engine"]]; + [storageEngines addObject:@{@"Engine" : @"MyISAM"}]; // Check if InnoDB support is enabled NSString *result = [self _getSingleVariableValue:@"have_innodb"]; if(result && [result isEqualToString:@"YES"]) - [storageEngines addObject:[NSDictionary dictionaryWithObject:@"InnoDB" forKey:@"Engine"]]; + [storageEngines addObject:@{@"Engine" : @"InnoDB"}]; // Before MySQL 4.1 the MEMORY engine was known as HEAP and the ISAM engine was included if ([serverSupport supportsPre41StorageEngines]) { - [storageEngines addObject:[NSDictionary dictionaryWithObject:@"HEAP" forKey:@"Engine"]]; - [storageEngines addObject:[NSDictionary dictionaryWithObject:@"ISAM" forKey:@"Engine"]]; + [storageEngines addObject:@{@"Engine" : @"HEAP"}]; + [storageEngines addObject:@{@"Engine" : @"ISAM"}]; } else { - [storageEngines addObject:[NSDictionary dictionaryWithObject:@"MEMORY" forKey:@"Engine"]]; + [storageEngines addObject:@{@"Engine" : @"MEMORY"}]; } // BLACKHOLE storage engine was added in MySQL 4.1.11 if ([serverSupport supportsBlackholeStorageEngine]) { - [storageEngines addObject:[NSDictionary dictionaryWithObject:@"BLACKHOLE" forKey:@"Engine"]]; + [storageEngines addObject:@{@"Engine" : @"BLACKHOLE"}]; } // ARCHIVE storage engine was added in MySQL 4.1.3 if ([serverSupport supportsArchiveStorageEngine]) { - [storageEngines addObject:[NSDictionary dictionaryWithObject:@"ARCHIVE" forKey:@"Engine"]]; + [storageEngines addObject:@{@"Engine" : @"ARCHIVE"}]; } // CSV storage engine was added in MySQL 4.1.4 if ([serverSupport supportsCSVStorageEngine]) { - [storageEngines addObject:[NSDictionary dictionaryWithObject:@"CSV" forKey:@"Engine"]]; + [storageEngines addObject:@{@"Engine" : @"CSV"}]; } } // The table information_schema.engines didn't exist until MySQL 5.1.5 diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 88ab58ed..c62b42e4 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -1012,8 +1012,8 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [self _addDatabase]; // Query the structure of all databases in the background (mainly for completion) - [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:databaseStructureRetrieval selector:@selector(queryDbStructureWithUserInfo:) object:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", nil]]; - } + [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:databaseStructureRetrieval selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; + } else { // Reset chooseDatabaseButton if ([[self database] length]) { @@ -1631,30 +1631,30 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; */ - (NSNumber *)encodingTagFromMySQLEncoding:(NSString *)mysqlEncoding { - NSDictionary *translationMap = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInt:SPEncodingUCS2], @"ucs2", - [NSNumber numberWithInt:SPEncodingUTF8], @"utf8", - [NSNumber numberWithInt:SPEncodingUTF8viaLatin1], @"utf8-", - [NSNumber numberWithInt:SPEncodingASCII], @"ascii", - [NSNumber numberWithInt:SPEncodingLatin1], @"latin1", - [NSNumber numberWithInt:SPEncodingMacRoman], @"macroman", - [NSNumber numberWithInt:SPEncodingCP1250Latin2], @"cp1250", - [NSNumber numberWithInt:SPEncodingISOLatin2], @"latin2", - [NSNumber numberWithInt:SPEncodingCP1256Arabic], @"cp1256", - [NSNumber numberWithInt:SPEncodingGreek], @"greek", - [NSNumber numberWithInt:SPEncodingHebrew], @"hebrew", - [NSNumber numberWithInt:SPEncodingLatin5Turkish], @"latin5", - [NSNumber numberWithInt:SPEncodingCP1257WinBaltic], @"cp1257", - [NSNumber numberWithInt:SPEncodingCP1251WinCyrillic], @"cp1251", - [NSNumber numberWithInt:SPEncodingBig5Chinese], @"big5", - [NSNumber numberWithInt:SPEncodingShiftJISJapanese], @"sjis", - [NSNumber numberWithInt:SPEncodingEUCJPJapanese], @"ujis", - [NSNumber numberWithInt:SPEncodingEUCKRKorean], @"euckr", - nil]; + NSDictionary *translationMap = @{ + @"ucs2" : @(SPEncodingUCS2), + @"utf8" : @(SPEncodingUTF8), + @"utf8-" : @(SPEncodingUTF8viaLatin1), + @"ascii" : @(SPEncodingASCII), + @"latin1" : @(SPEncodingLatin1), + @"macroman" : @(SPEncodingMacRoman), + @"cp1250" : @(SPEncodingCP1250Latin2), + @"latin2" : @(SPEncodingISOLatin2), + @"cp1256" : @(SPEncodingCP1256Arabic), + @"greek" : @(SPEncodingGreek), + @"hebrew" : @(SPEncodingHebrew), + @"latin5" : @(SPEncodingLatin5Turkish), + @"cp1257" : @(SPEncodingCP1257WinBaltic), + @"cp1251" : @(SPEncodingCP1251WinCyrillic), + @"big5" : @(SPEncodingBig5Chinese), + @"sjis" : @(SPEncodingShiftJISJapanese), + @"ujis" : @(SPEncodingEUCJPJapanese), + @"euckr" : @(SPEncodingEUCKRKorean) + }; NSNumber *encodingTag = [translationMap valueForKey:mysqlEncoding]; if (!encodingTag) - return [NSNumber numberWithInt:SPEncodingAutodetect]; + return @(SPEncodingAutodetect); return encodingTag; } @@ -2843,7 +2843,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [panel setAccessoryView:[SPEncodingPopupAccessory encodingAccessory:[prefs integerForKey:SPLastSQLFileEncoding] includeDefaultEntry:NO encodingPopUp:&encodingPopUp]]; - [panel setAllowedFileTypes:[NSArray arrayWithObjects:SPFileExtensionSQL, nil]]; + [panel setAllowedFileTypes:@[SPFileExtensionSQL]]; if (![prefs stringForKey:@"lastSqlFileName"]) { [prefs setObject:@"" forKey:@"lastSqlFileName"]; @@ -2880,7 +2880,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; } // Save current session (open connection windows as SPF file) - [panel setAllowedFileTypes:[NSArray arrayWithObjects:SPFileExtensionDefault, nil]]; + [panel setAllowedFileTypes:@[SPFileExtensionDefault]]; //Restore accessory view settings if possible if ([spfDocData objectForKey:@"save_password"]) { @@ -2933,7 +2933,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; return; } - [panel setAllowedFileTypes:[NSArray arrayWithObjects:SPBundleFileExtension, nil]]; + [panel setAllowedFileTypes:@[SPBundleFileExtension]]; NSDictionary *spfSessionData = [SPAppDelegate spfSessionDocData]; @@ -3357,7 +3357,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [spfStructure setObject:[stateDetails objectForKey:SPQueryFavorites] forKey:SPQueryFavorites]; [spfStructure setObject:[stateDetails objectForKey:SPQueryHistory] forKey:SPQueryHistory]; [spfStructure setObject:[stateDetails objectForKey:SPContentFilters] forKey:SPContentFilters]; - [stateDetails removeObjectsForKeys:[NSArray arrayWithObjects:SPQueryFavorites, SPQueryHistory, SPContentFilters, nil]]; + [stateDetails removeObjectsForKeys:@[SPQueryFavorites, SPQueryHistory, SPContentFilters]]; [spfData addEntriesFromDictionary:stateDetails]; // Determine whether to use encryption when adding the data @@ -3443,13 +3443,13 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [[parentWindow windowController] addNewConnection:self]; // Get the current state - NSDictionary *allStateDetails = [NSDictionary dictionaryWithObjectsAndKeys: - @YES, @"connection", - @YES, @"history", - @YES, @"session", - @YES, @"query", - @YES, @"password", - nil]; + NSDictionary *allStateDetails = @{ + @"connection" : @YES, + @"history" : @YES, + @"session" : @YES, + @"query" : @YES, + @"password" : @YES + }; NSMutableDictionary *currentState = [NSMutableDictionary dictionaryWithDictionary:[self stateIncludingDetails:allStateDetails]]; // Ensure it's set to autoconnect, and clear the table @@ -3589,7 +3589,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; } if (action == @selector(importFromClipboard:)){ - return [self database] && [[NSPasteboard generalPasteboard] availableTypeFromArray:[NSArray arrayWithObjects:NSStringPboardType, nil]]; + return [self database] && [[NSPasteboard generalPasteboard] availableTypeFromArray:@[NSStringPboardType]]; } // Change "Save Query/Queries" menu item title dynamically @@ -4046,7 +4046,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; */ - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar { - return [NSArray arrayWithObjects: + return @[ SPMainToolbarDatabaseSelection, SPMainToolbarHistoryNavigation, SPMainToolbarShowConsole, @@ -4061,8 +4061,8 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; NSToolbarCustomizeToolbarItemIdentifier, NSToolbarFlexibleSpaceItemIdentifier, NSToolbarSpaceItemIdentifier, - NSToolbarSeparatorItemIdentifier, - nil]; + NSToolbarSeparatorItemIdentifier + ]; } /** @@ -4070,7 +4070,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; */ - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar { - return [NSArray arrayWithObjects: + return @[ SPMainToolbarDatabaseSelection, SPMainToolbarTableStructure, SPMainToolbarTableContent, @@ -4081,8 +4081,8 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; NSToolbarFlexibleSpaceItemIdentifier, SPMainToolbarHistoryNavigation, SPMainToolbarUserManager, - SPMainToolbarShowConsole, - nil]; + SPMainToolbarShowConsole + ]; } /** @@ -4090,14 +4090,14 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; */ - (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar { - return [NSArray arrayWithObjects: + return @[ SPMainToolbarTableStructure, SPMainToolbarTableContent, SPMainToolbarCustomQuery, SPMainToolbarTableInfo, SPMainToolbarTableRelations, - SPMainToolbarTableTriggers, - nil]; + SPMainToolbarTableTriggers + ]; } @@ -5643,7 +5643,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; - (NSDictionary*)shellVariables { - if(!_isConnected) return [NSDictionary dictionary]; + if(!_isConnected) return @{}; NSMutableDictionary *env = [NSMutableDictionary dictionary]; @@ -5865,9 +5865,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; { NSPasteboard *pb = [NSPasteboard generalPasteboard]; - [pb declareTypes:[NSArray arrayWithObjects: NSTabularTextPboardType, - NSStringPboardType, nil] - owner:nil]; + [pb declareTypes:@[NSTabularTextPboardType, NSStringPboardType] owner:nil]; [pb setString:tmp forType:NSStringPboardType]; [pb setString:tmp forType:NSTabularTextPboardType]; diff --git a/Source/SPEditorPreferencePane.m b/Source/SPEditorPreferencePane.m index e5250e1d..d5127e65 100644 --- a/Source/SPEditorPreferencePane.m +++ b/Source/SPEditorPreferencePane.m @@ -66,7 +66,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined"; editThemeListItems = [[NSArray arrayWithArray:[self _getAvailableThemes]] retain]; editorColors = - [[NSArray arrayWithObjects: + [@[ SPCustomQueryEditorTextColor, SPCustomQueryEditorBackgroundColor, SPCustomQueryEditorCaretColor, @@ -77,11 +77,11 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined"; SPCustomQueryEditorBacktickColor, SPCustomQueryEditorVariableColor, SPCustomQueryEditorHighlightQueryColor, - SPCustomQueryEditorSelectionColor, - nil] retain]; + SPCustomQueryEditorSelectionColor + ] retain]; editorNameForColors = - [[NSArray arrayWithObjects: + [@[ NSLocalizedString(@"Text", @"text label for color table (Prefs > Editor)"), NSLocalizedString(@"Background", @"background label for color table (Prefs > Editor)"), NSLocalizedString(@"Caret", @"caret label for color table (Prefs > Editor)"), @@ -92,8 +92,8 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined"; NSLocalizedString(@"Backtick Quote", @"backtick quote label for color table (Prefs > Editor)"), NSLocalizedString(@"Variable", @"variable label for color table (Prefs > Editor)"), NSLocalizedString(@"Query Background", @"query background label for color table (Prefs > Editor)"), - NSLocalizedString(@"Selection", @"selection label for color table (Prefs > Editor)"), - nil] retain]; + NSLocalizedString(@"Selection", @"selection label for color table (Prefs > Editor)") + ] retain]; } return self; diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index 501b7c09..2e9eb9e2 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -490,7 +490,7 @@ static NSString *SPMySQLCommentField = @"Comment"; } NSError *error = nil; - NSArray *HTMLExcludes = [NSArray arrayWithObjects:@"doctype", @"html", @"head", @"body", @"xml", nil]; + NSArray *HTMLExcludes = @[@"doctype", @"html", @"head", @"body", @"xml"]; NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:NSHTMLTextDocumentType, NSDocumentTypeDocumentAttribute, HTMLExcludes, NSExcludedElementsDocumentAttribute, nil]; diff --git a/Source/SPFavoritesController.m b/Source/SPFavoritesController.m index 07d74ee0..76f376e8 100644 --- a/Source/SPFavoritesController.m +++ b/Source/SPFavoritesController.m @@ -377,7 +377,7 @@ static SPFavoritesController *sharedFavoritesController = nil; // from the current favourites tree and convert it to a dictionary representation // to create the plist data. This is done before file changes as it can sometimes // be terminated during shutdown. - NSDictionary *dictionary = [NSDictionary dictionaryWithObject:data forKey:SPFavoritesRootKey]; + NSDictionary *dictionary = @{SPFavoritesRootKey : data}; NSData *plistData = [NSPropertyListSerialization dataFromPropertyList:dictionary format:NSPropertyListXMLFormat_v1_0 diff --git a/Source/SPFavoritesExporter.m b/Source/SPFavoritesExporter.m index d9342fa8..a8b78a86 100644 --- a/Source/SPFavoritesExporter.m +++ b/Source/SPFavoritesExporter.m @@ -77,7 +77,7 @@ [favorites addObject:[node dictionaryRepresentation]]; } - NSDictionary *dictionary = [NSDictionary dictionaryWithObject:favorites forKey:SPFavoritesDataRootKey]; + NSDictionary *dictionary = @{SPFavoritesDataRootKey : favorites}; [favorites release]; diff --git a/Source/SPFavoritesImporter.m b/Source/SPFavoritesImporter.m index 8dc1d94f..f80d6cff 100644 --- a/Source/SPFavoritesImporter.m +++ b/Source/SPFavoritesImporter.m @@ -127,9 +127,9 @@ static NSString *SPOldPreferenceFileFavoritesKey = @"favorites"; */ - (void)_informDelegateOfErrorCode:(NSUInteger)code description:(NSString *)description { - NSError *error = [NSError errorWithDomain:NSCocoaErrorDomain - code:code - userInfo:[NSDictionary dictionaryWithObject:description forKey:NSLocalizedDescriptionKey]]; + NSError *error = [NSError errorWithDomain:NSCocoaErrorDomain + code:code + userInfo:@{NSLocalizedDescriptionKey : description}]; [self _informDelegateOfImportCompletion:error]; } diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index 2d8e9529..9048cfe9 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -143,7 +143,7 @@ } } - qlTypes = [[NSDictionary dictionaryWithObject:qlTypesItems forKey:SPQuickLookTypes] retain]; + qlTypes = [@{SPQuickLookTypes : qlTypesItems} retain]; [qlTypesItems release]; #endif diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 52b799d0..a79c8a40 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -162,7 +162,7 @@ static NSUInteger SPSourceColumnTypeInteger = 1; } - [defaultFieldTypesForComboBox setArray:[NSArray arrayWithObjects: + [defaultFieldTypesForComboBox setArray:@[ @"VARCHAR(255)", @"CHAR(63)", @"TEXT", @@ -172,9 +172,8 @@ static NSUInteger SPSourceColumnTypeInteger = 1; @"DATE", @"DATETIME", @"TIME", - @"TIMESTAMP", - nil - ]]; + @"TIMESTAMP" + ]]; [importFieldNamesHeaderSwitch setState:importFieldNamesHeader]; diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m index e9fd3f77..f363208c 100644 --- a/Source/SPGrowlController.m +++ b/Source/SPGrowlController.m @@ -98,7 +98,7 @@ static SPGrowlController *sharedGrowlController = nil; [notificationDictionary setObject:description forKey:@"description"]; [notificationDictionary setObject:document forKey:@"document"]; [notificationDictionary setObject:name forKey:@"name"]; - [notificationDictionary setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedInteger:[document hash]] forKey:@"notificationDocumentHash"] forKey:@"clickContext"]; + [notificationDictionary setObject:@{@"notificationDocumentHash" : @([document hash])} forKey:@"clickContext"]; [self performSelector:@selector(notifyWithObject:) withObject:notificationDictionary afterDelay:0.1]; } diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index 77ea9fbe..1b0128ca 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -294,7 +294,7 @@ for(NSUInteger i=0; i<maxLength; i++) [dummy appendString:@" "]; - CGFloat w = NSSizeToCGSize([dummy sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).width + 26.0f; + CGFloat w = NSSizeToCGSize([dummy sizeWithAttributes:@{NSFontAttributeName : tableFont}]).width + 26.0f; maxWindowWidth = (w>maxWindowWidth) ? maxWindowWidth : w; } else { maxWindowWidth = 220; @@ -712,7 +712,7 @@ closeMe = YES; return; } else { - [newFiltered addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"No item found", @"no item found message"), @"display", @"", @"noCompletion", nil]]; + [newFiltered addObject:@{@"display" : NSLocalizedString(@"No item found", @"no item found message"), @"noCompletion" : @""}]; } } } @@ -725,7 +725,7 @@ // if fetching db structure add dummy row for displaying that info on top of the list if(isQueryingDatabaseStructure) - [newFiltered insertObject:[NSDictionary dictionaryWithObjectsAndKeys:@"dummy", @"display", @"", @"noCompletion", nil] atIndex:0]; + [newFiltered insertObject:@{@"display" : @"dummy", @"noCompletion" : @""} atIndex:0]; NSPoint old = NSMakePoint([self frame].origin.x, [self frame].origin.y + [self frame].size.height); diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index 5db53418..07feee86 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -155,7 +155,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte [schemaStatusSplitView setMinSize:16.f ofSubviewAtIndex:1]; [self setWindowFrameAutosaveName:@"SPNavigator"]; - [outlineSchema2 registerForDraggedTypes:[NSArray arrayWithObjects:SPNavigatorTableDataPasteboardDragType, SPNavigatorPasteboardDragType, NSStringPboardType, nil]]; + [outlineSchema2 registerForDraggedTypes:@[SPNavigatorTableDataPasteboardDragType, SPNavigatorPasteboardDragType, NSStringPboardType]]; [outlineSchema2 setDraggingSourceOperationMask:NSDragOperationEvery forLocal:YES]; [outlineSchema2 setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO]; @@ -466,7 +466,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte if(a) [allSchemaKeys setObject:a forKey:connectionName]; } else { - [schemaData setObject:[NSDictionary dictionary] forKey:[NSString stringWithFormat:@"%@&DEL&no data loaded yet", connectionName]]; + [schemaData setObject:@{} forKey:[NSString stringWithFormat:@"%@&DEL&no data loaded yet", connectionName]]; [allSchemaKeys setObject:@[] forKey:connectionName]; } @@ -547,12 +547,12 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte } } - if([result count] < 1 ) return [NSArray arrayWithObjects:@0, @"", nil]; + if([result count] < 1 ) return @[@0, @""]; if([result count] == 1) { NSArray *split = [[result objectAtIndex:0] componentsSeparatedByString:SPUniqueSchemaDelimiter]; if([split count] == 2 ) return [NSArray arrayWithObjects:@1, [split lastObject], nil]; if([split count] == 3 ) return [NSArray arrayWithObjects:@2, [split lastObject], nil]; - return [NSArray arrayWithObjects:@0, @"", nil]; + return @[@0, @""]; } // case if field is equal to a table or db name NSMutableArray *arr = [NSMutableArray array]; @@ -560,14 +560,14 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte if([[item componentsSeparatedByString:SPUniqueSchemaDelimiter] count] < 4) [arr addObject:item]; } - if([arr count] < 1 ) [NSArray arrayWithObjects:@0, @"", nil]; + if([arr count] < 1 ) @[@0, @""]; if([arr count] == 1) { NSArray *split = [[arr objectAtIndex:0] componentsSeparatedByString:SPUniqueSchemaDelimiter]; if([split count] == 2 ) [NSArray arrayWithObjects:@1, [split lastObject], nil]; if([split count] == 3 ) [NSArray arrayWithObjects:@2, [split lastObject], nil]; - return [NSArray arrayWithObjects:@0, @"", nil]; + return @[@0, @""]; } - return [NSArray arrayWithObjects:@0, @"", nil]; + return @[@0, @""]; } #ifndef SP_CODA @@ -611,7 +611,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte if (![[doc getConnection] isConnected]) return; - [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[doc databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", nil]]; + [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[doc databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; } - (IBAction)outlineViewAction:(id)sender @@ -1113,7 +1113,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard { // Provide data for our custom type, and simple NSStrings. - [pboard declareTypes:[NSArray arrayWithObjects:SPNavigatorTableDataPasteboardDragType, SPNavigatorPasteboardDragType, NSStringPboardType, nil] owner:self]; + [pboard declareTypes:@[SPNavigatorTableDataPasteboardDragType, SPNavigatorPasteboardDragType, NSStringPboardType] owner:self]; // Collect the actual schema paths without leading connection ID NSMutableArray *draggedItems = [NSMutableArray array]; diff --git a/Source/SPPreferenceControllerDelegate.m b/Source/SPPreferenceControllerDelegate.m index ca08f2f0..ce05de6c 100644 --- a/Source/SPPreferenceControllerDelegate.m +++ b/Source/SPPreferenceControllerDelegate.m @@ -91,41 +91,41 @@ - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar { - return [NSArray arrayWithObjects: - SPPreferenceToolbarGeneral, - SPPreferenceToolbarTables, - SPPreferenceToolbarNotifications, - SPPreferenceToolbarEditor, - SPPreferenceToolbarShortcuts, - SPPreferenceToolbarAutoUpdate, - SPPreferenceToolbarNetwork, - nil]; + return @[ + SPPreferenceToolbarGeneral, + SPPreferenceToolbarTables, + SPPreferenceToolbarNotifications, + SPPreferenceToolbarEditor, + SPPreferenceToolbarShortcuts, + SPPreferenceToolbarAutoUpdate, + SPPreferenceToolbarNetwork + ]; } - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar { - return [NSArray arrayWithObjects: - SPPreferenceToolbarGeneral, - SPPreferenceToolbarTables, - SPPreferenceToolbarNotifications, - SPPreferenceToolbarEditor, - SPPreferenceToolbarShortcuts, - SPPreferenceToolbarAutoUpdate, - SPPreferenceToolbarNetwork, - nil]; + return @[ + SPPreferenceToolbarGeneral, + SPPreferenceToolbarTables, + SPPreferenceToolbarNotifications, + SPPreferenceToolbarEditor, + SPPreferenceToolbarShortcuts, + SPPreferenceToolbarAutoUpdate, + SPPreferenceToolbarNetwork + ]; } - (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar { - return [NSArray arrayWithObjects: - SPPreferenceToolbarGeneral, - SPPreferenceToolbarTables, - SPPreferenceToolbarNotifications, - SPPreferenceToolbarEditor, - SPPreferenceToolbarShortcuts, - SPPreferenceToolbarAutoUpdate, - SPPreferenceToolbarNetwork, - nil]; + return @[ + SPPreferenceToolbarGeneral, + SPPreferenceToolbarTables, + SPPreferenceToolbarNotifications, + SPPreferenceToolbarEditor, + SPPreferenceToolbarShortcuts, + SPPreferenceToolbarAutoUpdate, + SPPreferenceToolbarNetwork + ]; } @end diff --git a/Source/SPPreferencesUpgrade.m b/Source/SPPreferencesUpgrade.m index a412088c..d88dc4c8 100644 --- a/Source/SPPreferencesUpgrade.m +++ b/Source/SPPreferencesUpgrade.m @@ -130,22 +130,22 @@ void SPApplyRevisionChanges(void) if (recordedVersionNumber < 561) { NSEnumerator *keyEnumerator; NSString *oldKey, *newKey; - NSDictionary *keysToUpgrade = [NSDictionary dictionaryWithObjectsAndKeys: - @"encoding", SPDefaultEncoding, - @"useMonospacedFonts", SPUseMonospacedFonts, - @"reloadAfterAdding", SPReloadAfterAddingRow, - @"reloadAfterEditing", SPReloadAfterEditingRow, - @"reloadAfterRemoving", SPReloadAfterRemovingRow, - @"dontShowBlob", SPLoadBlobsAsNeeded, - @"fetchRowCount", @"FetchCorrectRowCount", - @"limitRows", SPLimitResults, - @"limitRowsValue", SPLimitResultsValue, - @"nullValue", SPNullValue, - @"showError", SPShowNoAffectedRowsError, - @"connectionTimeout", SPConnectionTimeoutValue, - @"keepAliveInterval", SPKeepAliveInterval, - @"lastFavoriteIndex", SPLastFavoriteID, - nil]; + NSDictionary *keysToUpgrade = @{ + SPDefaultEncoding : @"encoding", + SPUseMonospacedFonts : @"useMonospacedFonts", + SPReloadAfterAddingRow : @"reloadAfterAdding", + SPReloadAfterEditingRow : @"reloadAfterEditing", + SPReloadAfterRemovingRow : @"reloadAfterRemoving", + SPLoadBlobsAsNeeded : @"dontShowBlob", + @"FetchCorrectRowCount" : @"fetchRowCount", + SPLimitResults : @"limitRows", + SPLimitResultsValue : @"limitRowsValue", + SPNullValue : @"nullValue", + SPShowNoAffectedRowsError : @"showError", + SPConnectionTimeoutValue : @"connectionTimeout", + SPKeepAliveInterval : @"keepAliveInterval", + SPLastFavoriteID : @"lastFavoriteIndex" + }; keyEnumerator = [keysToUpgrade keyEnumerator]; @@ -255,7 +255,7 @@ void SPApplyRevisionChanges(void) if (([favorite isKindOfClass:[NSDictionary class]]) && ([favorite objectForKey:@"name"]) && ([favorite objectForKey:@"query"])) { NSMutableString *favoriteName = [NSMutableString stringWithString:[favorite objectForKey:@"name"]]; [favoriteName replaceOccurrencesOfString:@"\n" withString:@" " options:NSLiteralSearch range:NSMakeRange(0, [favoriteName length])]; - [queryFavoritesArray replaceObjectAtIndex:i withObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSString stringWithString:favoriteName], [favorite objectForKey:@"query"], nil] forKeys:[NSArray arrayWithObjects:@"name", @"query", nil]]]; + [queryFavoritesArray replaceObjectAtIndex:i withObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSString stringWithString:favoriteName], [favorite objectForKey:@"query"], nil] forKeys:@[@"name", @"query"]]]; continue; } @@ -268,7 +268,7 @@ void SPApplyRevisionChanges(void) [favoriteName appendString:@"..."]; } - [queryFavoritesArray replaceObjectAtIndex:i withObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSString stringWithString:favoriteName], favorite, nil] forKeys:[NSArray arrayWithObjects:@"name", @"query", nil]]]; + [queryFavoritesArray replaceObjectAtIndex:i withObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSString stringWithString:favoriteName], favorite, nil] forKeys:@[@"name", @"query"]]]; } [prefs setObject:queryFavoritesArray forKey:SPQueryFavorites]; @@ -287,27 +287,27 @@ void SPApplyRevisionChanges(void) // For versions prior to 2325 (<0.9.9), convert the old encoding pref string into the new localizable constant if (recordedVersionNumber < 2325 && [prefs objectForKey:SPOldDefaultEncodingKey] && [[prefs objectForKey:SPOldDefaultEncodingKey] isKindOfClass:[NSString class]]) { - NSDictionary *encodingMap = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInt:SPEncodingAutodetect], @"Autodetect", - [NSNumber numberWithInt:SPEncodingUCS2], @"UCS-2 Unicode (ucs2)", - [NSNumber numberWithInt:SPEncodingUTF8], @"UTF-8 Unicode (utf8)", - [NSNumber numberWithInt:SPEncodingUTF8viaLatin1], @"UTF-8 Unicode via Latin 1", - [NSNumber numberWithInt:SPEncodingASCII], @"US ASCII (ascii)", - [NSNumber numberWithInt:SPEncodingLatin1], @"ISO Latin 1 (latin1)", - [NSNumber numberWithInt:SPEncodingMacRoman], @"Mac Roman (macroman)", - [NSNumber numberWithInt:SPEncodingCP1250Latin2], @"Windows Latin 2 (cp1250)", - [NSNumber numberWithInt:SPEncodingISOLatin2], @"ISO Latin 2 (latin2)", - [NSNumber numberWithInt:SPEncodingCP1256Arabic], @"Windows Arabic (cp1256)", - [NSNumber numberWithInt:SPEncodingGreek], @"ISO Greek (greek)", - [NSNumber numberWithInt:SPEncodingHebrew], @"ISO Hebrew (hebrew)", - [NSNumber numberWithInt:SPEncodingLatin5Turkish], @"ISO Turkish (latin5)", - [NSNumber numberWithInt:SPEncodingCP1257WinBaltic], @"Windows Baltic (cp1257)", - [NSNumber numberWithInt:SPEncodingCP1251WinCyrillic], @"Windows Cyrillic (cp1251)", - [NSNumber numberWithInt:SPEncodingBig5Chinese], @"Big5 Traditional Chinese (big5)", - [NSNumber numberWithInt:SPEncodingShiftJISJapanese], @"Shift-JIS Japanese (sjis)", - [NSNumber numberWithInt:SPEncodingEUCJPJapanese], @"EUC-JP Japanese (ujis)", - [NSNumber numberWithInt:SPEncodingEUCKRKorean], @"EUC-KR Korean (euckr)", - nil]; + NSDictionary *encodingMap = @{ + @"Autodetect" : @(SPEncodingAutodetect), + @"UCS-2 Unicode (ucs2)" : @(SPEncodingUCS2), + @"UTF-8 Unicode (utf8)" : @(SPEncodingUTF8), + @"UTF-8 Unicode via Latin 1" : @(SPEncodingUTF8viaLatin1), + @"US ASCII (ascii)" : @(SPEncodingASCII), + @"ISO Latin 1 (latin1)" : @(SPEncodingLatin1), + @"Mac Roman (macroman)" : @(SPEncodingMacRoman), + @"Windows Latin 2 (cp1250)" : @(SPEncodingCP1250Latin2), + @"ISO Latin 2 (latin2)" : @(SPEncodingISOLatin2), + @"Windows Arabic (cp1256)" : @(SPEncodingCP1256Arabic), + @"ISO Greek (greek)" : @(SPEncodingGreek), + @"ISO Hebrew (hebrew)" : @(SPEncodingHebrew), + @"ISO Turkish (latin5)" : @(SPEncodingLatin5Turkish), + @"Windows Baltic (cp1257)" : @(SPEncodingCP1257WinBaltic), + @"Windows Cyrillic (cp1251)" : @(SPEncodingCP1251WinCyrillic), + @"Big5 Traditional Chinese (big5)" : @(SPEncodingBig5Chinese), + @"Shift-JIS Japanese (sjis)" : @(SPEncodingShiftJISJapanese), + @"EUC-JP Japanese (ujis)" : @(SPEncodingEUCJPJapanese), + @"EUC-KR Korean (euckr)" : @(SPEncodingEUCKRKorean) + }; NSNumber *newMappedValue = [encodingMap valueForKey:[prefs objectForKey:SPOldDefaultEncodingKey]]; @@ -394,7 +394,7 @@ void SPMigrateConnectionFavoritesData(void) [prefs removeObjectForKey:@"LastFavoriteIndex"]; } - NSDictionary *newFavorites = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Favorites", @"favorites label"), SPFavoritesGroupNameKey, favorites, SPFavoriteChildrenKey, nil] forKey:SPFavoritesRootKey]; + NSDictionary *newFavorites = @{SPFavoritesRootKey : [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Favorites", @"favorites label"), SPFavoritesGroupNameKey, favorites, SPFavoriteChildrenKey, nil]}; error = nil; NSString *errorString = nil; diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m index c77e82d2..f24a7891 100644 --- a/Source/SPProcessListController.m +++ b/Source/SPProcessListController.m @@ -167,7 +167,7 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id"; NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard]; // Copy the string to the pasteboard - [pasteBoard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:nil]; + [pasteBoard declareTypes:@[NSStringPboardType] owner:nil]; [pasteBoard setString:string forType:NSStringPboardType]; } } diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 0b1e59b6..c08aec3e 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -199,7 +199,7 @@ static SPQueryController *sharedQueryController = nil; NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard]; // Copy the string to the pasteboard - [pasteBoard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:nil]; + [pasteBoard declareTypes:@[NSStringPboardType] owner:nil]; [pasteBoard setString:string forType:NSStringPboardType]; } #endif diff --git a/Source/SPQueryControllerInitializer.m b/Source/SPQueryControllerInitializer.m index 8890a607..fc03d107 100644 --- a/Source/SPQueryControllerInitializer.m +++ b/Source/SPQueryControllerInitializer.m @@ -136,7 +136,7 @@ static NSString *SPCompletionTokensSnippetsKey = @"function_argument_snippets"; } } - return errorDescription ? [NSError errorWithDomain:NSCocoaErrorDomain code:1 userInfo:[NSDictionary dictionaryWithObject:errorDescription forKey:NSLocalizedDescriptionKey]] : nil; + return errorDescription ? [NSError errorWithDomain:NSCocoaErrorDomain code:1 userInfo:@{NSLocalizedDescriptionKey : errorDescription}] : nil; } @end diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m index 38758a45..649d4b5a 100644 --- a/Source/SPQueryFavoriteManager.m +++ b/Source/SPQueryFavoriteManager.m @@ -43,8 +43,6 @@ #define SP_MULTIPLE_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[multiple selection]", @"[multiple selection]") #define SP_NO_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[no selection]", @"[no selection]") -#define SP_Int(x) [NSNumber numberWithInteger:x] - @interface SPQueryFavoriteManager () - (void)_initWithNoSelection; @@ -86,11 +84,11 @@ - (void)awakeFromNib { #ifndef SP_CODA - [favorites addObject:[NSDictionary dictionaryWithObjectsAndKeys: - @"Global", @"name", - @"", @"headerOfFileURL", - @"", @"query", - nil]]; + [favorites addObject:@{ + @"name" : @"Global", + @"headerOfFileURL" : @"", + @"query" : @"" + }]; // Set up the split view [favoritesSplitView setMinSize:152.f ofSubviewAtIndex:0]; @@ -206,7 +204,7 @@ favorite = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[[favoriteNameTextField stringValue] stringByAppendingFormat:@" Copy"], [favoriteQueryTextView string], nil] forKeys:[NSArray arrayWithObjects:@"name", @"query", nil]]; // Add a new favorite else - favorite = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"New Favorite", @"", nil] forKeys:[NSArray arrayWithObjects:@"name", @"query", nil]]; + favorite = [NSMutableDictionary dictionaryWithObjects:@[@"New Favorite", @""] forKeys:@[@"name", @"query"]]; // If a favourite is currently selected, add the new favourite next to it if ([favoritesTableView numberOfSelectedRows] > 0) { @@ -380,24 +378,24 @@ { // Look up the sender's tag to determine the placeholder to insert. // Note that tag values alter behaviour slightly - see below. - NSDictionary *lookupTable = [NSDictionary dictionaryWithObjectsAndKeys: - NSLocalizedString(@"default_value", @"Query snippet default value placeholder"), SP_Int(100), - NSLocalizedString(@"$(shell_command)", @"Query snippet shell command syntax and placeholder"), SP_Int(101), - @"$1", SP_Int(501), - @"¦a¦b¦", SP_Int(102), - @"¦¦a¦b¦¦", SP_Int(103), - @"¦", SP_Int(104), - @"$SP_SELECTED_TABLE", SP_Int(105), - @"$SP_SELECTED_TABLES", SP_Int(106), - @"$SP_SELECTED_DATABASE", SP_Int(107), - @"¦$SP_ASLIST_ALL_FIELDS¦", SP_Int(108), - @"¦¦$SP_ASLIST_ALL_FIELDS¦¦", SP_Int(109), - @"¦$SP_ASLIST_ALL_TABLES¦", SP_Int(110), - @"¦¦$SP_ASLIST_ALL_TABLES¦¦", SP_Int(111), - @"¦$SP_ASLIST_ALL_DATABASES¦", SP_Int(112), - @"¦¦$SP_ASLIST_ALL_DATABASES¦¦", SP_Int(113), - nil]; - NSString *placeholder = [lookupTable objectForKey:SP_Int([[sender selectedItem] tag])]; + NSDictionary *lookupTable = @{ + @100 : NSLocalizedString(@"default_value", @"Query snippet default value placeholder"), + @101 : NSLocalizedString(@"$(shell_command)", @"Query snippet shell command syntax and placeholder"), + @501 : @"$1", + @102 : @"¦a¦b¦", + @103 : @"¦¦a¦b¦¦", + @104 : @"¦", + @105 : @"$SP_SELECTED_TABLE", + @106 : @"$SP_SELECTED_TABLES", + @107 : @"$SP_SELECTED_DATABASE", + @108 : @"¦$SP_ASLIST_ALL_FIELDS¦", + @109 : @"¦¦$SP_ASLIST_ALL_FIELDS¦¦", + @110 : @"¦$SP_ASLIST_ALL_TABLES¦", + @111 : @"¦¦$SP_ASLIST_ALL_TABLES¦¦", + @112 : @"¦$SP_ASLIST_ALL_DATABASES¦", + @113 : @"¦¦$SP_ASLIST_ALL_DATABASES¦¦" + }; + NSString *placeholder = [lookupTable objectForKey:[NSNumber numberWithInteger:[[sender selectedItem] tag]]]; if (!placeholder) [NSException raise:NSInternalInconsistencyException format:@"Inserted placeholder (%lld) not found", (long long)[[sender selectedItem] tag]]; // Iterate through the current snippets, to get the lowest unused tab counter, and diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m index 649e4ac3..9fd57e6d 100644 --- a/Source/SPSQLExporter.m +++ b/Source/SPSQLExporter.m @@ -614,7 +614,7 @@ } // Export procedures and functions - for (NSString *procedureType in [NSArray arrayWithObjects:@"PROCEDURE", @"FUNCTION", nil]) + for (NSString *procedureType in @[@"PROCEDURE", @"FUNCTION"]) { // Check for cancellation flag if ([self isCancelled]) { diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m index 43da2068..090970fb 100644 --- a/Source/SPServerVariablesController.m +++ b/Source/SPServerVariablesController.m @@ -370,7 +370,7 @@ NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard]; // Copy the string to the pasteboard - [pasteBoard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:nil]; + [pasteBoard declareTypes:@[NSStringPboardType] owner:nil]; [pasteBoard setString:string forType:NSStringPboardType]; } } diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index ae49c772..67825671 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -568,7 +568,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper #else NSFont *tableFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; #endif - [tableContentView setRowHeight:2.0f+NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; + [tableContentView setRowHeight:2.0f+NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:@{NSFontAttributeName : tableFont}]).height]; // Add the new columns to the table and filterTable for ( i = 0 ; i < (NSInteger)[dataColumns count] ; i++ ) { @@ -3333,7 +3333,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper NSDictionary *columnDefinition = [NSDictionary dictionaryWithDictionary:[cqColumnDefinition objectAtIndex:[[[[tableContentView tableColumns] objectAtIndex:columnIndex] identifier] integerValue]]]; if(!columnDefinition) - return [NSArray arrayWithObjects:@(-2), @"", nil]; + return @[@(-2), @""]; // Resolve the original table name for current column if AS was used NSString *tableForColumn = [columnDefinition objectForKey:@"org_table"]; @@ -3344,13 +3344,13 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper // No table/database name found indicates that the field's column contains data from more than one table as for UNION // or the field data are not bound to any table as in SELECT 1 or if column database is unset if(!tableForColumn || ![tableForColumn length] || !dbForColumn || ![dbForColumn length]) - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; // if table and database name are given check if field can be identified unambiguously // first without blob data NSString *fieldIDQueryStr = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"] includeBlobs:NO]; if(!fieldIDQueryStr) - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; [tableDocumentInstance startTaskWithDescription:NSLocalizedString(@"Checking field data for editing...", @"checking field data for editing task description")]; @@ -3362,7 +3362,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper if ([mySQLConnection queryErrored]) { [tableDocumentInstance endTask]; - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; } NSArray *tempRow = [tempResult getRowAsArray]; @@ -3372,7 +3372,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper fieldIDQueryStr = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"] includeBlobs:YES]; if(!fieldIDQueryStr) { [tableDocumentInstance endTask]; - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; } tempResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@.%@ %@", @@ -3382,14 +3382,14 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper if ([mySQLConnection queryErrored]) { [tableDocumentInstance endTask]; - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; } tempRow = [tempResult getRowAsArray]; if([tempRow count] && [[tempRow objectAtIndex:0] integerValue] < 1) { [tableDocumentInstance endTask]; - return [NSArray arrayWithObjects:@(-1), @"", nil]; + return @[@(-1), @""]; } } @@ -4252,7 +4252,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper else if ([keyPath isEqualToString:SPGlobalResultTableFont]) { NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]; - [tableContentView setRowHeight:2.0f + NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; + [tableContentView setRowHeight:2.0f + NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:@{NSFontAttributeName : tableFont}]).height]; [tableContentView setFont:tableFont]; [tableContentView reloadData]; } diff --git a/Source/SPTableData.m b/Source/SPTableData.m index 4ee09fd9..0e340f49 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -1170,7 +1170,7 @@ */ - (NSDictionary *) parseFieldDefinitionStringParts:(NSArray *)definitionParts { - if (![definitionParts count]) return [NSDictionary dictionary]; + if (![definitionParts count]) return @{}; SPSQLParser *detailParser; SPSQLParser *fieldParser = [[SPSQLParser alloc] init]; diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m index 76a11a5c..4b16bdc0 100644 --- a/Source/SPTableInfo.m +++ b/Source/SPTableInfo.m @@ -78,7 +78,7 @@ object:nil]; // Add activities header - [activities addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"ACTIVITIES", @"header for activities pane"), @"name", nil]]; + [activities addObject:@{@"name" : NSLocalizedString(@"ACTIVITIES", @"header for activities pane")}]; [activitiesTable reloadData]; // Add Information header @@ -110,7 +110,7 @@ NSMutableArray *acts = [NSMutableArray array]; [acts removeAllObjects]; - [acts addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"ACTIVITIES", @"header for activities pane"), @"name", nil]]; + [acts addObject:@{@"name" : NSLocalizedString(@"ACTIVITIES", @"header for activities pane")}]; [acts addObjectsFromArray:[tableDocumentInstance runningActivities]]; [acts addObjectsFromArray:[SPAppDelegate runningActivities]]; diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m index f2188a3b..f82dd3e7 100644 --- a/Source/SPTableRelations.m +++ b/Source/SPTableRelations.m @@ -163,7 +163,7 @@ static NSString *SPRelationOnDeleteKey = @"on_delete"; [thatTable backtickQuotedString], [thatColumn backtickQuotedString]]]; - NSArray *onActions = [NSArray arrayWithObjects:@"RESTRICT", @"CASCADE", @"SET NULL", @"NO ACTION", nil]; + NSArray *onActions = @[@"RESTRICT", @"CASCADE", @"SET NULL", @"NO ACTION"]; // If required add ON DELETE if ([onDeletePopUpButton selectedTag] >= 0) { diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index 1b922683..9013fb05 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -116,12 +116,11 @@ static NSString *SPRemoveFieldAndForeignKey = @"SPRemoveFieldAndForeignKey"; [indexesTableView setFont:useMonospacedFont ? [NSFont fontWithName:SPDefaultMonospacedFontName size:monospacedFontSize] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; #endif - extraFieldSuggestions = [[NSArray arrayWithObjects: - @"None", - @"auto_increment", - @"on update CURRENT_TIMESTAMP", - @"SERIAL DEFAULT VALUE", - nil + extraFieldSuggestions = [@[ + @"None", + @"auto_increment", + @"on update CURRENT_TIMESTAMP", + @"SERIAL DEFAULT VALUE" ] retain]; // Note that changing the contents or ordering of this array will affect the implementation of @@ -254,7 +253,7 @@ static NSString *SPRemoveFieldAndForeignKey = @"SPRemoveFieldAndForeignKey"; [tableFields insertObject:[NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"", @"INT", @"", @"0", @"0", @"0", allowNull ? @"1" : @"0", @"", [prefs stringForKey:SPNullValue], @"None", @"", @0, @0, nil] - forKeys:[NSArray arrayWithObjects:@"name", @"type", @"length", @"unsigned", @"zerofill", @"binary", @"null", @"Key", @"default", @"Extra", @"comment", @"encoding", @"collation", nil]] + forKeys:@[@"name", @"type", @"length", @"unsigned", @"zerofill", @"binary", @"null", @"Key", @"default", @"Extra", @"comment", @"encoding", @"collation"]] atIndex:insertIndex]; #else [tableFields insertObject:[NSMutableDictionary @@ -1208,7 +1207,7 @@ static NSString *SPRemoveFieldAndForeignKey = @"SPRemoveFieldAndForeignKey"; [indexesController setConnection:mySQLConnection]; // Set up tableView - [tableSourceView registerForDraggedTypes:[NSArray arrayWithObjects:SPDefaultPasteboardDragType, nil]]; + [tableSourceView registerForDraggedTypes:@[SPDefaultPasteboardDragType]]; } /** diff --git a/Source/SPTableStructureLoading.m b/Source/SPTableStructureLoading.m index 5366d49e..a15d31cd 100644 --- a/Source/SPTableStructureLoading.m +++ b/Source/SPTableStructureLoading.m @@ -288,9 +288,9 @@ // Query the structure of all databases in the background (mainly for completion) [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" - target:[tableDocumentInstance databaseStructureRetrieval] + target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) - object:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", nil]]; + object:@{@"forceUpdate" : @YES}]; [self loadTable:selectedTable]; } diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index 8d455b58..952d4868 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -168,7 +168,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; object:tableDocumentInstance]; #ifndef SP_CODA - [tablesListView registerForDraggedTypes:[NSArray arrayWithObjects:SPNavigatorTableDataPasteboardDragType, nil]]; + [tablesListView registerForDraggedTypes:@[SPNavigatorTableDataPasteboardDragType]]; #endif //create the charset helper @@ -360,7 +360,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:nil]; else // User press refresh button ergo force update - [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", @YES, @"cancelQuerying", nil]]; + [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES, @"cancelQuerying" : @YES}]; } /** @@ -704,13 +704,13 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; - (void)_duplicateConnectionToFrontTab { // Get the state of the document - NSDictionary *allStateDetails = [NSDictionary dictionaryWithObjectsAndKeys: - @YES, @"connection", - @YES, @"history", - @YES, @"session", - @YES, @"query", - @YES, @"password", - nil]; + NSDictionary *allStateDetails = @{ + @"connection" : @YES, + @"history" : @YES, + @"session" : @YES, + @"query" : @YES, + @"password" : @YES + }; NSMutableDictionary *documentState = [NSMutableDictionary dictionaryWithDictionary:[tableDocumentInstance stateIncludingDetails:allStateDetails]]; // Ensure it's set to autoconnect @@ -1621,7 +1621,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; #endif // Query the structure of all databases in the background (mainly for completion) - [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", nil]]; + [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; } #ifndef SP_CODA @@ -2276,10 +2276,10 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; #endif // Query the structure of all databases in the background (mainly for completion) - [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" - target:[tableDocumentInstance databaseStructureRetrieval] - selector:@selector(queryDbStructureWithUserInfo:) - object:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", nil]]; + [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" + target:[tableDocumentInstance databaseStructureRetrieval] + selector:@selector(queryDbStructureWithUserInfo:) + object:@{@"forceUpdate" : @YES}]; } #ifndef SP_CODA /* operations performed on whole tables */ @@ -2428,9 +2428,9 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; // Query the structure of all databases in the background (mainly for completion) [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" - target:[tableDocumentInstance databaseStructureRetrieval] + target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) - object:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", nil]]; + object:@{@"forceUpdate" : @YES}]; } else { // Error while creating new table @@ -2637,7 +2637,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; [tableDocumentInstance loadTable:selectedTableName ofType:selectedTableType]; // Query the structure of all databases in the background (mainly for completion) - [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", nil]]; + [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; } } } diff --git a/Source/SPTextAndLinkCell.m b/Source/SPTextAndLinkCell.m index a4d118ed..059ad6ec 100644 --- a/Source/SPTextAndLinkCell.m +++ b/Source/SPTextAndLinkCell.m @@ -176,7 +176,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect) /** * Allow hit tracking for link functionality */ -- (NSUInteger) hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView +- (NSCellHitResult) hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView { // Fast case for no link - make entire cell editable click area diff --git a/Source/SPTextView.m b/Source/SPTextView.m index 17c61faf..4ed92f94 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -2907,7 +2907,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS #endif if(tabStopWidth < 1) tabStopWidth = 1; - float tabWidth = NSSizeToCGSize([@" " sizeWithAttributes:[NSDictionary dictionaryWithObject:tvFont forKey:NSFontAttributeName]]).width; + float tabWidth = NSSizeToCGSize([@" " sizeWithAttributes:@{NSFontAttributeName : tvFont}]).width; tabWidth = (float)tabStopWidth * tabWidth; NSInteger numberOfTabs = 256/tabStopWidth; diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m index 276b5ebd..33564d81 100644 --- a/Source/SPTooltip.m +++ b/Source/SPTooltip.m @@ -96,7 +96,7 @@ static CGFloat slow_in_out (CGFloat t) + (void)showWithObject:(id)content atLocation:(NSPoint)point { - [self showWithObject:content atLocation:point ofType:@"text" displayOptions:[NSDictionary dictionary]]; + [self showWithObject:content atLocation:point ofType:@"text" displayOptions:@{}]; } + (void)showWithObject:(id)content atLocation:(NSPoint)point ofType:(NSString *)type diff --git a/Source/SPWindowManagement.m b/Source/SPWindowManagement.m index 022ad7fa..c30a2826 100644 --- a/Source/SPWindowManagement.m +++ b/Source/SPWindowManagement.m @@ -116,13 +116,13 @@ [[[self frontDocumentWindow] windowController] addNewConnection:self]; // Get the state of the previously-frontmost document - NSDictionary *allStateDetails = [NSDictionary dictionaryWithObjectsAndKeys: - @YES, @"connection", - @YES, @"history", - @YES, @"session", - @YES, @"query", - @YES, @"password", - nil]; + NSDictionary *allStateDetails = @{ + @"connection" : @YES, + @"history" : @YES, + @"session" : @YES, + @"query" : @YES, + @"password" : @YES + }; NSMutableDictionary *frontState = [NSMutableDictionary dictionaryWithDictionary:[theFrontDocument stateIncludingDetails:allStateDetails]]; |