aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseDocument.m
diff options
context:
space:
mode:
authorMarius Ursache <marius@marius.me.uk>2013-11-11 02:28:11 -0800
committerMarius Ursache <marius@marius.me.uk>2013-11-11 02:28:11 -0800
commitd46ab590d6a76894b7f282159663f00e5df511ef (patch)
tree1cbe404daf3c106f9809d5db540154e79e8a9b23 /Source/SPDatabaseDocument.m
parentc769bd0a420bdd1273c43b91b28a818bfd5f5008 (diff)
parentdf35d702fe561629fddfa66cd99d0839b8e05910 (diff)
downloadsequelpro-d46ab590d6a76894b7f282159663f00e5df511ef.tar.gz
sequelpro-d46ab590d6a76894b7f282159663f00e5df511ef.tar.bz2
sequelpro-d46ab590d6a76894b7f282159663f00e5df511ef.zip
Merge pull request #1853 from bamse16/master
beginSheetForDirectory: updates for OSX 10.6+ SDK
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r--Source/SPDatabaseDocument.m34
1 files changed, 12 insertions, 22 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 05c25e92..6a3e4151 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -2305,7 +2305,18 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
[panel setAllowsOtherFileTypes:YES];
[panel setCanSelectHiddenExtension:YES];
- [panel beginSheetForDirectory:nil file:@"CreateSyntax" modalForWindow:createTableSyntaxWindow modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:SPCreateSyntx];
+ [panel setNameFieldStringValue:[NSString stringWithFormat:@"CreateSyntax-%@", [self table]]];
+ [panel beginSheetModalForWindow:createTableSyntaxWindow completionHandler:^(NSInteger returnCode) {
+ if (returnCode == NSOKButton) {
+ NSString *createSyntax = [createTableSyntaxTextView string];
+
+ if ([createSyntax length] > 0) {
+ NSString *output = [NSString stringWithFormat:@"-- %@ '%@'\n\n%@\n", NSLocalizedString(@"Create syntax for", @"create syntax for table comment"), [self table], createSyntax];
+
+ [output writeToURL:[panel URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
+ }
+ }
+ }];
}
/**
@@ -3686,27 +3697,6 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
}
/**
- * Called when the NSSavePanel sheet ends. Writes the server variables to the selected file if required.
- */
-- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
-{
-#ifndef SP_CODA
- if (returnCode == NSOKButton) {
- if ([contextInfo isEqualToString:SPCreateSyntx]) {
-
- NSString *createSyntax = [createTableSyntaxTextView string];
-
- if ([createSyntax length] > 0) {
- NSString *output = [NSString stringWithFormat:@"-- %@ '%@'\n\n%@\n", NSLocalizedString(@"Create syntax for", @"create syntax for table comment"), [self table], createSyntax];
-
- [output writeToURL:[sheet URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
- }
- }
- }
-#endif
-}
-
-/**
* Return the createTableSyntaxWindow
*/
- (NSWindow *)getCreateTableSyntaxWindow