aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableStructure.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-04-03 09:34:29 +0000
committerstuconnolly <stuart02@gmail.com>2011-04-03 09:34:29 +0000
commit3ed8b33deeadcc98185911f41bc6bcb4e53b4719 (patch)
treeb0e20fd5a534a0e24fe00206163fdca5245882fd /Source/SPTableStructure.m
parentc7a4e604462e11bf26dc7b58645fa6429848e6fc (diff)
downloadsequelpro-3ed8b33deeadcc98185911f41bc6bcb4e53b4719.tar.gz
sequelpro-3ed8b33deeadcc98185911f41bc6bcb4e53b4719.tar.bz2
sequelpro-3ed8b33deeadcc98185911f41bc6bcb4e53b4719.zip
Bring outline view branch up to date with trunk (r3246:r3264).
Diffstat (limited to 'Source/SPTableStructure.m')
-rw-r--r--Source/SPTableStructure.m15
1 files changed, 13 insertions, 2 deletions
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index 904e4517..aab62af8 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -203,7 +203,6 @@
}
NSMutableArray *theTableFields = [[NSMutableArray alloc] init];
- [theTableFields setArray:[NSArray array]];
// Make a mutable copy out of the cached [tableDataInstance columns] since we're adding infos
for (id col in [tableDataInstance columns])
@@ -352,6 +351,10 @@
*/
- (IBAction)reloadTable:(id)sender
{
+
+ // Check whether a save of the current row is required
+ if ( ![[self onMainThread] saveRowOnDeselect] ) return;
+
[tableDataInstance resetAllData];
[tableDocumentInstance setStatusRequiresReload:YES];
@@ -379,9 +382,9 @@
[indexesController setTable:selectedTable];
// Reset the table store and display
+ [tableSourceView deselectAll:self];
[tableFields removeAllObjects];
[enumFields removeAllObjects];
- [tableSourceView deselectAll:self];
[indexesTableView deselectAll:self];
[addFieldButton setEnabled:NO];
[copyFieldButton setEnabled:NO];
@@ -846,6 +849,14 @@
*/
- (BOOL)saveRowOnDeselect
{
+
+ // Save any edits which have been made but not saved to the table yet;
+ // but not for any NSSearchFields which could cause a crash for undo, redo.
+ id currentFirstResponder = [[tableDocumentInstance parentWindow] firstResponder];
+ if (currentFirstResponder && [currentFirstResponder isKindOfClass:[NSView class]] && [(NSView *)currentFirstResponder isDescendantOf:tableSourceView]) {
+ [[tableDocumentInstance parentWindow] endEditingFor:nil];
+ }
+
// If no rows are currently being edited, or a save is already in progress, return success at once.
if (!isEditingRow || isSavingRow) return YES;
isSavingRow = YES;