From 842e85a37b698be1245dee0948a1abd99973638c Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 1 Dec 2010 21:42:58 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Bundle=20Editor=20/=20Bundle=20commands=20-?= =?UTF-8?q?=20enabled=20trigger=20support=20to=20run=20a=20command=20if=20?= =?UTF-8?q?db,=20table,=20or=20table=20row=20was=20changed=20-=20HTML=20ou?= =?UTF-8?q?tput=20window=20will=20be=20ordered=20out=20without=20making=20?= =?UTF-8?q?it=20the=20key=20window=20to=20remain=20the=20first=20responder?= =?UTF-8?q?=20=E2=80=A2=20SPTableTExtFieldCell=20-=20forgotten=20to=20remo?= =?UTF-8?q?ve=20expansionFrameWithFrame:=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPDatabaseViewController.m | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Source/SPDatabaseViewController.m') diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m index c1b1bdbf..8cf97998 100644 --- a/Source/SPDatabaseViewController.m +++ b/Source/SPDatabaseViewController.m @@ -481,6 +481,27 @@ // Empty the loading pool and exit the thread [self endTask]; + + NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableChanged]; + for(NSString* cmdPath in triggeredCommands) { + NSArray *data = [cmdPath componentsSeparatedByString:@"|"]; + NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; + [aMenuItem setTag:0]; + [aMenuItem setToolTip:[data objectAtIndex:0]]; + if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { + [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; + } + else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { + if([[[[NSApp mainWindow] firstResponder] 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]; + } + } + + [loadPool drain]; } -- cgit v1.2.3