aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-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