aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableSource.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-06-23 12:00:49 +0000
committerBibiko <bibiko@eva.mpg.de>2009-06-23 12:00:49 +0000
commitdc84b62997c3cd70f15d14f60c64d3a9fa163fb3 (patch)
treefbf7a4452ab1fc09f841c037bde8885d4f5b4205 /Source/TableSource.m
parent7b9852ea31e5a070a1f862f42f21c53423a3fb9b (diff)
downloadsequelpro-dc84b62997c3cd70f15d14f60c64d3a9fa163fb3.tar.gz
sequelpro-dc84b62997c3cd70f15d14f60c64d3a9fa163fb3.tar.bz2
sequelpro-dc84b62997c3cd70f15d14f60c64d3a9fa163fb3.zip
• fixed issue for showing an error alert sheet inside of a endSheet selector of an other sheet:
- introduced -(void)showErrorSheetWithTitle:(id)error -- error is an array of title and message - this can be called via [self performSelector:@selector(showErrorSheetWithTitle:) withObject: afterDelay:] - this avoids a crash of the current table window
Diffstat (limited to 'Source/TableSource.m')
-rw-r--r--Source/TableSource.m31
1 files changed, 25 insertions, 6 deletions
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 24fd13a5..2f66d1fb 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -847,10 +847,13 @@ fetches the result as an array with a dictionary for each row in it
[tablesListInstance setContentRequiresReload:YES];
[tableDataInstance resetColumnData];
} else {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove field %@.\nMySQL said: %@", @"message of panel when field cannot be removed"),
- [[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"],
- [mySQLConnection getLastErrorMessage]]);
+ [self performSelector:@selector(showErrorSheetWithTitle:)
+ withObject:[NSArray arrayWithObjects:NSLocalizedString(@"Error", @"error"),
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove field %@.\nMySQL said: %@", @"message of panel when field cannot be removed"),
+ [[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"],
+ [mySQLConnection getLastErrorMessage]],
+ nil]
+ afterDelay:0.3];
}
}
} else if ( [contextInfo isEqualToString:@"removeindex"] ) {
@@ -866,8 +869,12 @@ fetches the result as an array with a dictionary for each row in it
if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
[self loadTable:selectedTable];
} else {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove index.\nMySQL said: %@", @"message of panel when index cannot be removed"), [mySQLConnection getLastErrorMessage]]);
+ [self performSelector:@selector(showErrorSheetWithTitle:)
+ withObject:[NSArray arrayWithObjects:NSLocalizedString(@"Error", @"error"),
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove index.\nMySQL said: %@", @"message of panel when index cannot be removed"),
+ [mySQLConnection getLastErrorMessage]],
+ nil]
+ afterDelay:0.3];
}
}
} else if ( [contextInfo isEqualToString:@"cannotremovefield"]) {
@@ -876,6 +883,18 @@ fetches the result as an array with a dictionary for each row in it
}
+/*
+ * Show Error sheet (can be called from inside of a endSheet selector)
+ * via [self performSelector:@selector(showErrorSheetWithTitle:) withObject: afterDelay:]
+ */
+-(void)showErrorSheetWithTitle:(id)error
+{
+ // error := first object is the title , second the message, only one button OK
+ NSBeginAlertSheet([error objectAtIndex:0], NSLocalizedString(@"OK", @"OK button"),
+ nil, nil, tableWindow, self, nil, nil, nil,
+ [error objectAtIndex:1]);
+}
+
/**
* This method is called as part of Key Value Observing which is used to watch for preference changes which effect the interface.
*/