From 370e35a72e344c5a2c29ff76cdf1e84b4f475807 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 9 Dec 2010 21:26:48 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Bundle=20commands=20-=20added=20the=20shell?= =?UTF-8?q?=20vars=20for=20edited=20field=20info=20as=20well=20if=20Field?= =?UTF-8?q?=20Editor=20sheet=20is=20used?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPCustomQuery.m | 7 +++++++ Source/SPFieldEditorController.h | 4 ++++ Source/SPFieldEditorController.m | 2 ++ Source/SPTableContent.m | 6 +++++- Source/SPTextViewAdditions.m | 11 +++++++++-- 5 files changed, 27 insertions(+), 3 deletions(-) (limited to 'Source') diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index c313edaf..e8420b7c 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -2342,6 +2342,13 @@ if([columnDefinition objectForKey:@"null"]) allowNULL = (![[columnDefinition objectForKey:@"null"] integerValue]); + [fieldEditor setEditedFieldInfo:[NSDictionary dictionaryWithObjectsAndKeys: + [columnDefinition objectForKey:@"org_name"], @"colName", + [columnDefinition objectForKey:@"org_table"], @"tableName", + [self usedQuery], @"usedQuery", + @"query", @"tableSource", + nil]]; + [fieldEditor setTextMaxLength:fieldLength]; [fieldEditor setFieldType:(fieldType==nil) ? @"" : fieldType]; [fieldEditor setFieldEncoding:(fieldEncoding==nil) ? @"" : fieldEncoding]; diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h index 625e9869..568ba629 100644 --- a/Source/SPFieldEditorController.h +++ b/Source/SPFieldEditorController.h @@ -163,8 +163,12 @@ BOOL _isGeometry; NSUndoManager *esUndoManager; + NSDictionary *editedFieldInfo; + } +@property(readwrite, retain) NSDictionary *editedFieldInfo; + - (IBAction)closeEditSheet:(id)sender; - (IBAction)openEditSheet:(id)sender; - (IBAction)saveEditSheet:(id)sender; diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index 17595947..2e761f80 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -34,6 +34,8 @@ @implementation SPFieldEditorController +@synthesize editedFieldInfo; + /** * Initialise an instance of SPFieldEditorController using the XIB “FieldEditorSheet.xib”. Init the available Quciklook format by reading * EditorQuickLookTypes.plist and if given user-defined format store in the Preferences for key (SPQuickLookTypes). diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 4f466470..1e9bdf5f 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -4036,7 +4036,11 @@ if(fieldEditor) [fieldEditor release], fieldEditor = nil; fieldEditor = [[SPFieldEditorController alloc] init]; - + [fieldEditor setEditedFieldInfo:[NSDictionary dictionaryWithObjectsAndKeys: + [[aTableColumn headerCell] stringValue], @"colName", + [self usedQuery], @"usedQuery", + @"content", @"tableSource", + nil]]; [fieldEditor setTextMaxLength:fieldLength]; [fieldEditor setFieldType:(fieldType==nil) ? @"" : fieldType]; [fieldEditor setFieldEncoding:(fieldEncoding==nil) ? @"" : fieldEncoding]; diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m index c85b5c51..5dd7d06c 100644 --- a/Source/SPTextViewAdditions.m +++ b/Source/SPTextViewAdditions.m @@ -578,9 +578,16 @@ [env setObject:bundleInputFilePath forKey:SPBundleShellVariableInputFilePath]; [env setObject:SPBundleScopeInputField forKey:SPBundleShellVariableScope]; - id tableSource = [self delegate]; - if([[[tableSource class] description] isEqualToString:@"SPCopyTable"]) { + if([[[tableSource class] description] isEqualToString:@"SPFieldEditorController"]) { + NSDictionary *editedFieldInfo = [tableSource editedFieldInfo]; + [env setObject:[editedFieldInfo objectForKey:@"colName"] forKey:SPBundleShellVariableCurrentEditedColumnName]; + if([editedFieldInfo objectForKey:@"tableName"]) + [env setObject:[editedFieldInfo objectForKey:@"tableName"] forKey:SPBundleShellVariableCurrentEditedTable]; + [env setObject:[editedFieldInfo objectForKey:@"usedQuery"] forKey:SPBundleShellVariableUsedQueryForTable]; + [env setObject:[editedFieldInfo objectForKey:@"tableSource"] forKey:SPBundleShellVariableDataTableSource]; + } + else if([[[tableSource class] description] isEqualToString:@"SPCopyTable"]) { NSInteger editedCol = [tableSource editedColumn]; if(editedCol > -1) { NSString *colName = [[[[tableSource tableColumns] objectAtIndex:editedCol] headerCell] stringValue]; -- cgit v1.2.3