diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-12-08 11:05:28 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-12-08 11:05:28 +0000 |
commit | d51530a48813b08d9694fed3a7a24998d495d5b5 (patch) | |
tree | fbd418bf3028fe541592e8768013d2e7973db777 /Source/SPCopyTable.m | |
parent | 70dc76057c5e61497a5ef495df2a90c91335b44b (diff) | |
download | sequelpro-d51530a48813b08d9694fed3a7a24998d495d5b5.tar.gz sequelpro-d51530a48813b08d9694fed3a7a24998d495d5b5.tar.bz2 sequelpro-d51530a48813b08d9694fed3a7a24998d495d5b5.zip |
• Bundle commands
- reworked invocation via keyboard short-cut to allow to fall back to General scope
- added chance to redirect the output action via command exit codes; useful if the normal output is an HTML window but an error occurred, now one can display the error as tooltip for instance
- unified file hand-shake file names by one uuid
- made usage of more constants and renamed some shell vars
Diffstat (limited to 'Source/SPCopyTable.m')
-rw-r--r-- | Source/SPCopyTable.m | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 8c627e1d..58339976 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -1146,13 +1146,14 @@ NSInteger kBlobAsImageFile = 4; inputFallBackAction = [[cmdData objectForKey:SPBundleFileInputSourceFallBackKey] lowercaseString]; NSMutableDictionary *env = [NSMutableDictionary dictionary]; - [env setObject:[infoPath stringByDeletingLastPathComponent] forKey:@"SP_BUNDLE_PATH"]; - [env setObject:bundleInputFilePath forKey:@"SP_BUNDLE_INPUT_FILE"]; + [env setObject:[infoPath stringByDeletingLastPathComponent] forKey:SPBundleShellVariableBundlePath]; + [env setObject:bundleInputFilePath forKey:SPBundleShellVariableInputFilePath]; if([[self delegate] respondsToSelector:@selector(usedQuery)] && [[self delegate] usedQuery]) [env setObject:[[self delegate] usedQuery] forKey:@"SP_USED_QUERY_FOR_TABLE"]; - [env setObject:bundleInputTableMetaDataFilePath forKey:@"SP_BUNDLE_INPUT_TABLE_METADATA"]; + [env setObject:bundleInputTableMetaDataFilePath forKey:SPBundleShellVariableInputTableMetaData]; + [env setObject:SPBundleScopeDataTable forKey:SPBundleShellVariableScope]; if([self numberOfSelectedRows]) { NSMutableArray *sel = [NSMutableArray array]; @@ -1181,7 +1182,7 @@ NSInteger kBlobAsImageFile = 4; if(blobHandling != kBlobExclude) { NSString *bundleBlobFilePath = [NSString stringWithFormat:@"%@_%@", SPBundleTaskCopyBlobFileDirectory, uuid]; - [env setObject:bundleBlobFilePath forKey:@"SP_BUNDLE_BLOB_FILES_DIRECTORY"]; + [env setObject:bundleBlobFilePath forKey:SPBundleShellVariableBlobFileDirectory]; [self setCopyBlobFileDirectory:bundleBlobFilePath]; } else { [self setCopyBlobFileDirectory:@""]; @@ -1267,15 +1268,53 @@ NSInteger kBlobAsImageFile = 4; contextInfo:[NSDictionary dictionaryWithObjectsAndKeys: ([cmdData objectForKey:SPBundleFileNameKey])?:@"-", @"name", NSLocalizedString(@"Data Table", @"data table menu item label"), @"scope", + uuid, SPBundleFileInternalexecutionUUID, nil] error:&err]; [[NSFileManager defaultManager] removeItemAtPath:bundleInputFilePath error:nil]; + NSString *action = [[cmdData objectForKey:SPBundleFileOutputActionKey] lowercaseString]; + + // Redirect due exit code + if(err != nil) { + if([err code] == SPBundleRedirectActionNone) { + action = SPBundleOutputActionNone; + err = nil; + } + else if([err code] == SPBundleRedirectActionReplaceSection) { + action = SPBundleOutputActionReplaceSelection; + err = nil; + } + else if([err code] == SPBundleRedirectActionReplaceContent) { + action = SPBundleOutputActionReplaceContent; + err = nil; + } + else if([err code] == SPBundleRedirectActionInsertAsText) { + action = SPBundleOutputActionInsertAsText; + err = nil; + } + else if([err code] == SPBundleRedirectActionInsertAsSnippet) { + action = SPBundleOutputActionInsertAsSnippet; + err = nil; + } + else if([err code] == SPBundleRedirectActionShowAsHTML) { + action = SPBundleOutputActionShowAsHTML; + err = nil; + } + else if([err code] == SPBundleRedirectActionShowAsTextTooltip) { + action = SPBundleOutputActionShowAsTextTooltip; + err = nil; + } + else if([err code] == SPBundleRedirectActionShowAsHTMLTooltip) { + action = SPBundleOutputActionShowAsHTMLTooltip; + err = nil; + } + } + if(err == nil && output) { if([cmdData objectForKey:SPBundleFileOutputActionKey] && [[cmdData objectForKey:SPBundleFileOutputActionKey] length] && ![[cmdData objectForKey:SPBundleFileOutputActionKey] isEqualToString:SPBundleOutputActionNone]) { - NSString *action = [[cmdData objectForKey:SPBundleFileOutputActionKey] lowercaseString]; NSPoint pos = [NSEvent mouseLocation]; pos.y -= 16; |