diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-12-09 20:54:16 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-12-09 20:54:16 +0000 |
commit | 3187b984cc76491bf1aabacdf8b2deb5046eaf0a (patch) | |
tree | 1c8c6a4a17faf280d16531b52767a094a0ed48f3 /Source/SPCustomQuery.m | |
parent | 34eac092acd118620c2653731e283ca8aa7fc383 (diff) | |
download | sequelpro-3187b984cc76491bf1aabacdf8b2deb5046eaf0a.tar.gz sequelpro-3187b984cc76491bf1aabacdf8b2deb5046eaf0a.tar.bz2 sequelpro-3187b984cc76491bf1aabacdf8b2deb5046eaf0a.zip |
• Bundle Commands
- added shell vars SP_CURRENT_EDITED_COLUMN_NAME, SP_CURRENT_EDITED_TABLE for Input Field scoped commands if invoked from a table cell field editor
- added shell var SP_TABLE_DATA_SOURCE (content or query)
- fixed table row change trigger for custom query tableView
Diffstat (limited to 'Source/SPCustomQuery.m')
-rw-r--r-- | Source/SPCustomQuery.m | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index ef38461c..c313edaf 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -2386,6 +2386,54 @@ #pragma mark TableView notifications /** + * Check triggering of Bundle command for row selection changes + */ +- (void)tableViewSelectionDidChange:(NSNotification *)aNotification +{ + + // Check our notification object is our table content view + if ([aNotification object] != customQueryView) return; + + NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableRowChanged]; + for(NSString* cmdPath in triggeredCommands) { + NSArray *data = [cmdPath componentsSeparatedByString:@"|"]; + NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; + [aMenuItem setTag:0]; + [aMenuItem setToolTip:[data objectAtIndex:0]]; + + // For HTML output check if corresponding window already exists + BOOL stopTrigger = NO; + if([[data objectAtIndex:2] length]) { + BOOL correspondingWindowFound = NO; + NSString *uuid = [data objectAtIndex:2]; + for(id win in [NSApp windows]) { + if([[[[win delegate] class] description] isEqualToString:@"SPBundleHTMLOutputController"]) { + if([[[win delegate] windowUUID] isEqualToString:uuid]) { + correspondingWindowFound = YES; + break; + } + } + } + if(!correspondingWindowFound) stopTrigger = YES; + } + if(!stopTrigger) { + if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { + [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; + } + else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { + if([[[[[NSApp mainWindow] firstResponder] class] description] isEqualToString:@"SPCopyTable"]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForDataTable:aMenuItem]; + } + else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeInputField]) { + if([[[NSApp mainWindow] firstResponder] isKindOfClass:[NSTextView class]]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForInputField:aMenuItem]; + } + } + } + +} + +/** * Saves the new column size in the preferences for columns which map to fields */ - (void)tableViewColumnDidResize:(NSNotification *)aNotification |