aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPBundleEditorController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-12-01 14:57:27 +0000
committerBibiko <bibiko@eva.mpg.de>2010-12-01 14:57:27 +0000
commita7981fb1f88c16fbd0f7732a03d63f599d94309b (patch)
tree2dd7166d8a2b141651e9485fa31c9007295da9f4 /Source/SPBundleEditorController.m
parent40b1a5d57e6445f5a644521018ceb7762b3b59b8 (diff)
downloadsequelpro-a7981fb1f88c16fbd0f7732a03d63f599d94309b.tar.gz
sequelpro-a7981fb1f88c16fbd0f7732a03d63f599d94309b.tar.bz2
sequelpro-a7981fb1f88c16fbd0f7732a03d63f599d94309b.zip
• progress on trigger support for Bundle commands
Diffstat (limited to 'Source/SPBundleEditorController.m')
-rw-r--r--Source/SPBundleEditorController.m50
1 files changed, 49 insertions, 1 deletions
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index 823feae8..60f95f3b 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -429,9 +429,30 @@
}
+/**
+ * Store trigger in bundle dict since it is not bound
+ * via key binding and update various GUI elements
+ */
- (IBAction)triggerButtonChanged:(id)sender
{
-
+
+ id currentDict = [self _currentSelectedObject];
+
+ NSMenu* senderMenu = [sender menu];
+
+ NSInteger selectedIndex = [senderMenu indexOfItem:sender];
+ NSString *input = SPBundleTriggerActionNone;
+ if(senderMenu == triggerGeneralPopUpMenu)
+ input = [triggerGeneralArray objectAtIndex:selectedIndex];
+ else if(senderMenu == triggerInputFieldPopUpMenu)
+ input = [triggerInputFieldArray objectAtIndex:selectedIndex];
+ else if(senderMenu == triggerDataTablePopUpMenu)
+ input = [triggerDataTableArray objectAtIndex:selectedIndex];
+
+ [currentDict setObject:input forKey:SPBundleFileTriggerKey];
+
+ [self _updateBundleDataView];
+
}
/**
@@ -1594,6 +1615,9 @@
NSString *scope = [currentDict objectForKey:SPBundleFileScopeKey];
if(!scope) scope = SPBundleScopeGeneral;
+ NSString *trigger = [currentDict objectForKey:SPBundleFileTriggerKey];
+ if(!trigger) trigger = SPBundleTriggerActionNone;
+
// Update the scope popup button
if([scope isEqualToString:SPBundleScopeGeneral])
[scopePopupButton selectItemWithTag:kGeneralScopeArrayIndex];
@@ -1609,40 +1633,64 @@
case kGeneralScopeArrayIndex: // General
[inputPopupButton setMenu:inputNonePopUpMenu];
[inputPopupButton selectItemAtIndex:0];
+
[outputPopupButton setMenu:outputGeneralScopePopUpMenu];
anIndex = [outputGeneralScopeArray indexOfObject:output];
if(anIndex == NSNotFound) anIndex = 0;
[outputPopupButton selectItemAtIndex:anIndex];
+
+ [triggerPopupButton setMenu:triggerGeneralPopUpMenu];
+ anIndex = [triggerGeneralArray indexOfObject:trigger];
+ if(anIndex == NSNotFound) anIndex = 0;
+ [triggerPopupButton selectItemAtIndex:anIndex];
+
input = SPBundleInputSourceNone;
[inputFallbackPopupButton setHidden:YES];
[fallbackLabelField setHidden:YES];
+
break;
case kInputFieldScopeArrayIndex: // Input Field
[inputPopupButton setMenu:inputInputFieldScopePopUpMenu];
anIndex = [inputInputFieldScopeArray indexOfObject:input];
if(anIndex == NSNotFound) anIndex = 0;
[inputPopupButton selectItemAtIndex:anIndex];
+
[inputFallbackPopupButton setMenu:inputFallbackInputFieldScopePopUpMenu];
anIndex = [inputFallbackInputFieldScopeArray indexOfObject:inputfallback];
if(anIndex == NSNotFound) anIndex = 0;
[inputFallbackPopupButton selectItemAtIndex:anIndex];
+
[outputPopupButton setMenu:outputInputFieldScopePopUpMenu];
anIndex = [outputInputFieldScopeArray indexOfObject:output];
if(anIndex == NSNotFound) anIndex = 0;
[outputPopupButton selectItemAtIndex:anIndex];
+
+ [triggerPopupButton setMenu:triggerInputFieldPopUpMenu];
+ anIndex = [triggerInputFieldArray indexOfObject:trigger];
+ if(anIndex == NSNotFound) anIndex = 0;
+ [triggerPopupButton selectItemAtIndex:anIndex];
+
break;
case kDataTableScopeArrayIndex: // Data Table
[inputPopupButton setMenu:inputDataTableScopePopUpMenu];
anIndex = [inputDataTableScopeArray indexOfObject:input];
if(anIndex == NSNotFound) anIndex = 0;
[inputPopupButton selectItemAtIndex:anIndex];
+
[outputPopupButton setMenu:outputDataTableScopePopUpMenu];
anIndex = [outputDataTableScopeArray indexOfObject:output];
if(anIndex == NSNotFound) anIndex = 0;
[outputPopupButton selectItemAtIndex:anIndex];
+
input = SPBundleInputSourceNone;
[inputFallbackPopupButton setHidden:YES];
[fallbackLabelField setHidden:YES];
+
+ [triggerPopupButton setMenu:triggerDataTablePopUpMenu];
+ anIndex = [triggerDataTableArray indexOfObject:trigger];
+ if(anIndex == NSNotFound) anIndex = 0;
+ [triggerPopupButton selectItemAtIndex:anIndex];
+
break;
case kDisabledScopeTag: // Disable command
break;