diff options
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r-- | Source/SPDatabaseDocument.m | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 02889b5e..2729932f 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -5301,6 +5301,19 @@ [[parentWindow onMainThread] makeFirstResponder:[tablesListInstance valueForKeyPath:@"tablesListView"]]; } + // If a the table has changed, update the selection + if (![targetItemName isEqualToString:[self table]]) { + if (targetItemName) { + [tablesListInstance selectItemWithName:targetItemName]; + } else { + [[tablesListInstance onMainThread] setTableListSelectability:YES]; + [[[tablesListInstance valueForKey:@"tablesListView"] onMainThread] deselectAll:self]; + [[tablesListInstance onMainThread] setTableListSelectability:NO]; + } + } + + [self endTask]; + NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionDatabaseChanged]; for(NSString* cmdPath in triggeredCommands) { NSArray *data = [cmdPath componentsSeparatedByString:@"|"]; @@ -5308,28 +5321,19 @@ [aMenuItem setTag:0]; [aMenuItem setToolTip:[data objectAtIndex:0]]; if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { - ; - } - else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeInputField]) { - ; + [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; } else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { - ; + if([[[NSApp mainWindow] firstResponder] isKindOfClass:[SPCopyTable class]]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForDataTable:aMenuItem]; } - } - - // If a the table has changed, update the selection - if (![targetItemName isEqualToString:[self table]]) { - if (targetItemName) { - [tablesListInstance selectItemWithName:targetItemName]; - } else { - [[tablesListInstance onMainThread] setTableListSelectability:YES]; - [[[tablesListInstance valueForKey:@"tablesListView"] onMainThread] deselectAll:self]; - [[tablesListInstance onMainThread] setTableListSelectability:NO]; + else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeInputField]) { + if([[[NSApp mainWindow] firstResponder] isKindOfClass:[NSTextView class]]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForInputField:aMenuItem]; } } - [self endTask]; [taskPool drain]; + } @end |