From 68e90d59bbb8660751e9fb74cd6553c4b32bcfa5 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Tue, 19 Oct 2010 19:40:37 +0000 Subject: Add a 'Edit Trigger' menu item to the trigger's table view context menu. --- Interfaces/English.lproj/DBView.xib | 1072 +++++++------------------------- Resources/English.lproj/DBView.strings | Bin 99310 -> 100836 bytes Source/SPTableTriggers.h | 2 +- Source/SPTableTriggers.m | 186 +++--- 4 files changed, 339 insertions(+), 921 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 0e85b00d..3d816896 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -3,7 +3,7 @@ 1050 10F569 - 788 + 804 1038.29 461.00 @@ -16,14 +16,15 @@ YES - 788 - 788 + 804 + 804 1.2.5 YES - + + YES @@ -940,7 +941,7 @@ source - + 256 YES @@ -1055,7 +1056,6 @@ - 1 YES 1 YES @@ -2419,7 +2419,6 @@ {{10, 7}, {706, 544}} - Structure @@ -5728,7 +5727,7 @@ triggers - + 256 YES @@ -6161,20 +6160,21 @@ {{10, 7}, {706, 544}} + Triggers - + 134217731 YES YES YES - + @@ -11560,6 +11560,14 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA YES + + + Edit Trigger + + 2147483647 + + + Delete Trigger @@ -16151,6 +16159,14 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA 7667 + + + editTrigger: + + + + 7669 + @@ -18145,6 +18161,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA YES + Table Triggers Menu @@ -22664,6 +22681,11 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA + + 7668 + + + @@ -23966,6 +23988,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA 7656.IBPluginDependency 7660.IBPluginDependency 7661.IBPluginDependency + 7668.IBPluginDependency 858.IBPluginDependency 858.ImportedFromIB2 959.IBEditorWindowLastContentRect @@ -25111,7 +25134,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{539, 190}, {150, 23}} + {{463, 559}, {150, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -25298,7 +25321,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{85, 417}, {943, 549}} + {{109, 183}, {943, 549}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -25752,6 +25775,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{265, 489}, {405, 267}} com.apple.InterfaceBuilder.CocoaPlugin @@ -25789,7 +25813,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA - 7667 + 7669 @@ -27049,6 +27073,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA importFromClipboard: openCurrentConnectionInNewWindow: optimizeTable: + refreshTables: removeDatabase: renameDatabase: repairTable: @@ -27122,6 +27147,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA id id id + id @@ -27154,6 +27180,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA importFromClipboard: openCurrentConnectionInNewWindow: optimizeTable: + refreshTables: removeDatabase: renameDatabase: repairTable: @@ -27283,6 +27310,10 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA optimizeTable: id + + refreshTables: + id + removeDatabase: id @@ -29463,16 +29494,21 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA YES addRow: + closeSheet: copyRow: filterTable: navigatePaginationFromButton: reloadTable: removeRow: setCompareTypes: - showTableFilter: + setDefaultOperator: + showFilterTable: + swapFilterTable: tableFilterClear: - tableFilterExecute: + toggleDistinctSelect: toggleFilterField: + toggleLookAllFieldsMode: + toggleNegateClause: togglePagination: @@ -29489,6 +29525,11 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA id id id + id + id + id + id + id @@ -29496,16 +29537,21 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA YES addRow: + closeSheet: copyRow: filterTable: navigatePaginationFromButton: reloadTable: removeRow: setCompareTypes: - showTableFilter: + setDefaultOperator: + showFilterTable: + swapFilterTable: tableFilterClear: - tableFilterExecute: + toggleDistinctSelect: toggleFilterField: + toggleLookAllFieldsMode: + toggleNegateClause: togglePagination: @@ -29514,6 +29560,10 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA addRow: id + + closeSheet: + id + copyRow: id @@ -29539,7 +29589,15 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA id - showTableFilter: + setDefaultOperator: + id + + + showFilterTable: + id + + + swapFilterTable: id @@ -29547,13 +29605,21 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA id - tableFilterExecute: + toggleDistinctSelect: id toggleFilterField: id + + toggleLookAllFieldsMode: + id + + + toggleNegateClause: + id + togglePagination: id @@ -29575,7 +29641,13 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA fieldField filterButton filterTableClearButton + filterTableDistinctMenuItem filterTableFilterButton + filterTableGearLookAllFields + filterTableLiveSearchCheckbox + filterTableNegateCheckbox + filterTableSetDefaultOperatorSheet + filterTableSetDefaultOperatorValue filterTableView filterTableWhereClause filterTableWindow @@ -29614,7 +29686,13 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA NSPopUpButton id NSButton + NSMenuItem NSButton + NSMenuItem + id + id + NSPanel + NSComboBox SPCopyTable SPTextView NSPanel @@ -29656,7 +29734,13 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA fieldField filterButton filterTableClearButton + filterTableDistinctMenuItem filterTableFilterButton + filterTableGearLookAllFields + filterTableLiveSearchCheckbox + filterTableNegateCheckbox + filterTableSetDefaultOperatorSheet + filterTableSetDefaultOperatorValue filterTableView filterTableWhereClause filterTableWindow @@ -29728,10 +29812,34 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA filterTableClearButton NSButton + + filterTableDistinctMenuItem + NSMenuItem + filterTableFilterButton NSButton + + filterTableGearLookAllFields + NSMenuItem + + + filterTableLiveSearchCheckbox + id + + + filterTableNegateCheckbox + id + + + filterTableSetDefaultOperatorSheet + NSPanel + + + filterTableSetDefaultOperatorValue + NSComboBox + filterTableView SPCopyTable @@ -30163,6 +30271,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA removeField: resetAutoIncrement: showOptimizedFieldType: + toggleColumnView: unhideIndexesView: @@ -30176,6 +30285,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA id id id + id @@ -30190,6 +30300,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA removeField: resetAutoIncrement: showOptimizedFieldType: + toggleColumnView: unhideIndexesView: @@ -30226,6 +30337,10 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA showOptimizedFieldType: id + + toggleColumnView: + id + unhideIndexesView: id @@ -30262,6 +30377,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA tableSourceView tablesIndexesSplitView tablesListInstance + viewColumnsMenu YES @@ -30291,6 +30407,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA id NSSplitView id + id @@ -30323,6 +30440,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA tableSourceView tablesIndexesSplitView tablesListInstance + viewColumnsMenu YES @@ -30430,6 +30548,10 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA tablesListInstance id + + viewColumnsMenu + id + @@ -30463,6 +30585,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA addTrigger: closeTriggerSheet: confirmAddTrigger: + editTrigger: refreshTriggers: removeTrigger: @@ -30473,6 +30596,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA id id id + id @@ -30482,6 +30606,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA addTrigger: closeTriggerSheet: confirmAddTrigger: + editTrigger: refreshTriggers: removeTrigger: @@ -30499,6 +30624,10 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA confirmAddTrigger: id + + editTrigger: + id + refreshTriggers: id @@ -31146,860 +31275,113 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA - + YES - SPTableContent - NSObject + BWAnchoredButton + NSButton + + IBFrameworkSource + BWToolkitFramework.framework/Headers/BWAnchoredButton.h + + + + BWAnchoredButtonBar + NSView + + IBFrameworkSource + BWToolkitFramework.framework/Headers/BWAnchoredButtonBar.h + + + + BWAnchoredButtonCell + NSButtonCell + + IBFrameworkSource + BWToolkitFramework.framework/Headers/BWAnchoredButtonCell.h + + + + BWAnchoredPopUpButton + NSPopUpButton + + IBFrameworkSource + BWToolkitFramework.framework/Headers/BWAnchoredPopUpButton.h + + + + BWAnchoredPopUpButtonCell + NSPopUpButtonCell + + IBFrameworkSource + BWToolkitFramework.framework/Headers/BWAnchoredPopUpButtonCell.h + + + + BWGradientBox + NSView + + IBFrameworkSource + BWToolkitFramework.framework/Headers/BWGradientBox.h + + + + BWInsetTextField + NSTextField + + IBFrameworkSource + BWToolkitFramework.framework/Headers/BWInsetTextField.h + + + + BWSplitView + NSSplitView - YES - - YES - addRow: - closeSheet: - copyRow: - filterTable: - navigatePaginationFromButton: - reloadTable: - removeRow: - setCompareTypes: - setDefaultOperator: - showFilterTable: - swapFilterTable: - tableFilterClear: - toggleDistinctSelect: - toggleFilterField: - toggleLookAllFieldsMode: - toggleNegateClause: - togglePagination: - - - YES - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - + toggleCollapse: + id - YES - - YES - addRow: - closeSheet: - copyRow: - filterTable: - navigatePaginationFromButton: - reloadTable: - removeRow: - setCompareTypes: - setDefaultOperator: - showFilterTable: - swapFilterTable: - tableFilterClear: - toggleDistinctSelect: - toggleFilterField: - toggleLookAllFieldsMode: - toggleNegateClause: - togglePagination: + toggleCollapse: + + toggleCollapse: + id - - YES - - addRow: - id - - - closeSheet: - id - - - copyRow: - id - - - filterTable: - id - - - navigatePaginationFromButton: - id - - - reloadTable: - id - - - removeRow: - id - - - setCompareTypes: - id - - - setDefaultOperator: - id - - - showFilterTable: - id - - - swapFilterTable: - id - - - tableFilterClear: - id - - - toggleDistinctSelect: - id - - - toggleFilterField: - id - - - toggleLookAllFieldsMode: - id - - - toggleNegateClause: - id - - - togglePagination: - id - - - - - YES - - YES - addButton - argumentField - betweenTextField - compareField - contentFilterManager - contentViewPane - copyButton - countText - fieldField - filterButton - filterTableClearButton - filterTableDistinctMenuItem - filterTableFilterButton - filterTableGearLookAllFields - filterTableLiveSearchCheckbox - filterTableNegateCheckbox - filterTableSetDefaultOperatorSheet - filterTableSetDefaultOperatorValue - filterTableView - filterTableWhereClause - filterTableWindow - firstBetweenField - limitRowsButton - limitRowsField - limitRowsStepper - multipleLineEditingButton - paginationButton - paginationNextButton - paginationPageField - paginationPageStepper - paginationPreviousButton - paginationView - reloadButton - removeButton - secondBetweenField - spHistoryControllerInstance - tableContentView - tableDataInstance - tableDocumentInstance - tableInfoInstance - tableSourceInstance - tablesListInstance - - - YES - id - id - id - id - id - NSView - id - id - NSPopUpButton - id - NSButton - NSMenuItem - NSButton - NSMenuItem - id - id - NSPanel - NSComboBox - SPCopyTable - SPTextView - NSPanel - id - id - id - id - id - NSButton - NSButton - NSTextField - NSStepper - NSButton - NSView - id - id - id - SPHistoryController - SPCopyTable - id - id - SPTableInfo - id - id - - - - YES - - YES - addButton - argumentField - betweenTextField - compareField - contentFilterManager - contentViewPane - copyButton - countText - fieldField - filterButton - filterTableClearButton - filterTableDistinctMenuItem - filterTableFilterButton - filterTableGearLookAllFields - filterTableLiveSearchCheckbox - filterTableNegateCheckbox - filterTableSetDefaultOperatorSheet - filterTableSetDefaultOperatorValue - filterTableView - filterTableWhereClause - filterTableWindow - firstBetweenField - limitRowsButton - limitRowsField - limitRowsStepper - multipleLineEditingButton - paginationButton - paginationNextButton - paginationPageField - paginationPageStepper - paginationPreviousButton - paginationView - reloadButton - removeButton - secondBetweenField - spHistoryControllerInstance - tableContentView - tableDataInstance - tableDocumentInstance - tableInfoInstance - tableSourceInstance - tablesListInstance - - - YES - - addButton - id - - - argumentField - id - - - betweenTextField - id - - - compareField - id - - - contentFilterManager - id - - - contentViewPane - NSView - - - copyButton - id - - - countText - id - - - fieldField - NSPopUpButton - - - filterButton - id - - - filterTableClearButton - NSButton - - - filterTableDistinctMenuItem - NSMenuItem - - - filterTableFilterButton - NSButton - - - filterTableGearLookAllFields - NSMenuItem - - - filterTableLiveSearchCheckbox - id - - - filterTableNegateCheckbox - id - - - filterTableSetDefaultOperatorSheet - NSPanel - - - filterTableSetDefaultOperatorValue - NSComboBox - - - filterTableView - SPCopyTable - - - filterTableWhereClause - SPTextView - - - filterTableWindow - NSPanel - - - firstBetweenField - id - - - limitRowsButton - id - - - limitRowsField - id - - - limitRowsStepper - id - - - multipleLineEditingButton - id - - - paginationButton - NSButton - - - paginationNextButton - NSButton - - - paginationPageField - NSTextField - - - paginationPageStepper - NSStepper - - - paginationPreviousButton - NSButton - - - paginationView - NSView - - - reloadButton - id - - - removeButton - id - - - secondBetweenField - id - - - spHistoryControllerInstance - SPHistoryController - - - tableContentView - SPCopyTable - - - tableDataInstance - id - - - tableDocumentInstance - id - - - tableInfoInstance - SPTableInfo - - - tableSourceInstance - id - - - tablesListInstance - id - - - - - IBDocumentRelativeSource - ../../Source/SPTableContent.h - - - - SPTableStructure - NSObject - - YES - - YES - addField: - closeKeySheet: - closeSheet: - copyField: - reloadTable: - removeField: - resetAutoIncrement: - showOptimizedFieldType: - toggleColumnView: - unhideIndexesView: - - - YES - id - id - id - id - id - id - id - id - id - id - - - - YES - - YES - addField: - closeKeySheet: - closeSheet: - copyField: - reloadTable: - removeField: - resetAutoIncrement: - showOptimizedFieldType: - toggleColumnView: - unhideIndexesView: - - - YES - - addField: - id - - - closeKeySheet: - id - - - closeSheet: - id - - - copyField: - id - - - reloadTable: - id - - - removeField: - id - - - resetAutoIncrement: - id - - - showOptimizedFieldType: - id - - - toggleColumnView: - id - - - unhideIndexesView: - id - - - - - YES - - YES - addFieldButton - addIndexButton - chooseKeyButton - copyFieldButton - databaseDataInstance - editTableButton - encodingPopupCell - extendedTableInfoInstance - indexesController - indexesShowButton - indexesTableView - keySheet - refreshIndexesButton - reloadFieldsButton - removeFieldButton - removeIndexButton - resetAutoIncrementLine - resetAutoIncrementSheet - resetAutoIncrementValue - structureGrabber - tableDataInstance - tableDocumentInstance - tableInfoInstance - tableSourceView - tablesIndexesSplitView - tablesListInstance - viewColumnsMenu - - - YES - id - id - id - id - id - id - id - id - id - NSButton - id - id - id - id - id - id - id - id - id - id - id - id - id - id - NSSplitView - id - id - - - - YES - - YES - addFieldButton - addIndexButton - chooseKeyButton - copyFieldButton - databaseDataInstance - editTableButton - encodingPopupCell - extendedTableInfoInstance - indexesController - indexesShowButton - indexesTableView - keySheet - refreshIndexesButton - reloadFieldsButton - removeFieldButton - removeIndexButton - resetAutoIncrementLine - resetAutoIncrementSheet - resetAutoIncrementValue - structureGrabber - tableDataInstance - tableDocumentInstance - tableInfoInstance - tableSourceView - tablesIndexesSplitView - tablesListInstance - viewColumnsMenu - - - YES - - addFieldButton - id - - - addIndexButton - id - - - chooseKeyButton - id - - - copyFieldButton - id - - - databaseDataInstance - id - - - editTableButton - id - - - encodingPopupCell - id - - - extendedTableInfoInstance - id - - - indexesController - id - - - indexesShowButton - NSButton - - - indexesTableView - id - - - keySheet - id - - - refreshIndexesButton - id - - - reloadFieldsButton - id - - - removeFieldButton - id - - - removeIndexButton - id - - - resetAutoIncrementLine - id - - - resetAutoIncrementSheet - id - - - resetAutoIncrementValue - id - - - structureGrabber - id - - - tableDataInstance - id - - - tableDocumentInstance - id - - - tableInfoInstance - id - - - tableSourceView - id - - - tablesIndexesSplitView - NSSplitView - - - tablesListInstance - id - - - viewColumnsMenu - id - - - - - IBDocumentRelativeSource - ../../Source/SPTableStructure.h - - - - YES - - BWAnchoredButton - NSButton IBFrameworkSource - BWToolkitFramework.framework/Headers/BWAnchoredButton.h + BWToolkitFramework.framework/Headers/BWSplitView.h - BWAnchoredButtonBar - NSView + BWTransparentButton + NSButton IBFrameworkSource - BWToolkitFramework.framework/Headers/BWAnchoredButtonBar.h + BWToolkitFramework.framework/Headers/BWTransparentButton.h - BWAnchoredButtonCell + BWTransparentButtonCell NSButtonCell IBFrameworkSource - BWToolkitFramework.framework/Headers/BWAnchoredButtonCell.h - - - - BWAnchoredPopUpButton - NSPopUpButton - - IBFrameworkSource - BWToolkitFramework.framework/Headers/BWAnchoredPopUpButton.h - - - - BWAnchoredPopUpButtonCell - NSPopUpButtonCell - - IBFrameworkSource - BWToolkitFramework.framework/Headers/BWAnchoredPopUpButtonCell.h - - - - BWGradientBox - NSView - - IBFrameworkSource - BWToolkitFramework.framework/Headers/BWGradientBox.h - - - - BWInsetTextField - NSTextField - - IBFrameworkSource - BWToolkitFramework.framework/Headers/BWInsetTextField.h - - - - BWSplitView - NSSplitView - - toggleCollapse: - id - - - toggleCollapse: - - toggleCollapse: - id - - - - IBFrameworkSource - BWToolkitFramework.framework/Headers/BWSplitView.h + BWToolkitFramework.framework/Headers/BWTransparentButtonCell.h - BWTransparentButton + BWTransparentCheckbox NSButton IBFrameworkSource - BWToolkitFramework.framework/Headers/BWTransparentButton.h + BWToolkitFramework.framework/Headers/BWTransparentCheckbox.h - BWTransparentButtonCell + BWTransparentCheckboxCell NSButtonCell IBFrameworkSource - BWToolkitFramework.framework/Headers/BWTransparentButtonCell.h + BWToolkitFramework.framework/Headers/BWTransparentCheckboxCell.h @@ -32026,6 +31408,14 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA BWToolkitFramework.framework/Headers/BWTransparentTableView.h + + BWTransparentTableViewCell + NSTextFieldCell + + IBFrameworkSource + BWToolkitFramework.framework/Headers/BWTransparentTableViewCell.h + + NSActionCell NSCell diff --git a/Resources/English.lproj/DBView.strings b/Resources/English.lproj/DBView.strings index 00bf0e69..3573001b 100644 Binary files a/Resources/English.lproj/DBView.strings and b/Resources/English.lproj/DBView.strings differ diff --git a/Source/SPTableTriggers.h b/Source/SPTableTriggers.h index b2a754ce..b7bd61fd 100644 --- a/Source/SPTableTriggers.h +++ b/Source/SPTableTriggers.h @@ -23,7 +23,6 @@ // // More info at -#import #import @interface SPTableTriggers : NSObject @@ -68,6 +67,7 @@ // IB action methods - (IBAction)addTrigger:(id)sender; +- (IBAction)editTrigger:(id)sender; - (IBAction)removeTrigger:(id)sender; - (IBAction)closeTriggerSheet:(id)sender; - (IBAction)confirmAddTrigger:(id)sender; diff --git a/Source/SPTableTriggers.m b/Source/SPTableTriggers.m index 86f0aa53..a934f450 100644 --- a/Source/SPTableTriggers.m +++ b/Source/SPTableTriggers.m @@ -34,6 +34,7 @@ @interface SPTableTriggers (PrivateAPI) +- (void)_editTriggerAtIndex:(NSInteger)index; - (void)_toggleConfirmAddTriggerButtonEnabled; - (void)_refreshTriggerDataForcingCacheRefresh:(BOOL)clearAllCaches; @@ -43,6 +44,9 @@ @synthesize connection; +#pragma mark - +#pragma mark Initialization + /** * init */ @@ -274,6 +278,14 @@ } } +/** + * Edits the selected trigger. + */ +- (IBAction)editTrigger:(id)sender +{ + [self _editTriggerAtIndex:[triggersTableView selectedRow]]; +} + /** * Trigger a refresh of the displayed triggers via the interface. */ @@ -309,54 +321,13 @@ /** * Double-click action on table cells - for the time being, return NO to disable editing. */ -- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex +- (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex { if ([tableDocumentInstance isWorking]) return NO; // Start Edit panel - if (([triggerData count] > rowIndex) && ([triggerData objectAtIndex:rowIndex] != NSNotFound)) - { - NSDictionary *trigger = [triggerData objectAtIndex:rowIndex]; - - // Cache the original trigger's name and statement in the event that the editing process fails and - // we need to recreate it. - editTriggerName = [trigger objectForKey:@"trigger"]; - editTriggerStatement = [trigger objectForKey:@"statement"]; - editTriggerTableName = [trigger objectForKey:@"table"]; - editTriggerEvent = [trigger objectForKey:@"event"]; - editTriggerActionTime = [trigger objectForKey:@"timing"]; - - [triggerNameTextField setStringValue:editTriggerName]; - [triggerStatementTextView setString:editTriggerStatement]; - - // Timin title is different then what we have saved in the database (case difference) - for (NSUInteger i = 0; i < [[triggerActionTimePopUpButton itemArray] count]; i++) - { - if ([[[triggerActionTimePopUpButton itemTitleAtIndex:i] uppercaseString] isEqualToString:[[trigger objectForKey:@"timing"] uppercaseString]]) { - [triggerActionTimePopUpButton selectItemAtIndex:i]; - break; - } - } - - // Event title is different then what we have saved in the database (case difference) - for (NSUInteger i = 0; i < [[triggerEventPopUpButton itemArray] count]; i++) - { - if ([[[triggerEventPopUpButton itemTitleAtIndex:i] uppercaseString] isEqualToString:[[trigger objectForKey:@"event"] uppercaseString]]) { - [triggerEventPopUpButton selectItemAtIndex:i]; - break; - } - } - - // Change button label from Add to Edit - [confirmAddTriggerButton setTitle:NSLocalizedString(@"Save", @"Save trigger button label")]; - - isEdit = YES; - - [NSApp beginSheet:addTriggerPanel - modalForWindow:[tableDocumentInstance parentWindow] - modalDelegate:self - didEndSelector:nil - contextInfo:nil]; + if (([triggerData count] > rowIndex) && ([triggerData objectAtIndex:rowIndex] != NSNotFound)) { + [self _editTriggerAtIndex:rowIndex]; } return NO; @@ -365,7 +336,7 @@ /** * Disable row selection while the document is working. */ -- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex +- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)rowIndex { return (![tableDocumentInstance isWorking]); } @@ -472,24 +443,21 @@ */ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { + SEL action = [menuItem action]; + // Remove row - if ([menuItem action] == @selector(removeTrigger:)) { + if (action == @selector(removeTrigger:)) { [menuItem setTitle:([triggersTableView numberOfSelectedRows] > 1) ? NSLocalizedString(@"Delete Triggers", @"delete triggers menu item") : NSLocalizedString(@"Delete Trigger", @"delete trigger menu item")]; return ([triggersTableView numberOfSelectedRows] > 0); } + else if (action == @selector(editTrigger:)) { + return ([triggersTableView numberOfSelectedRows] == 1); + } return YES; } -/** - * Toggles the enabled state of confirm add trigger button based on the editing of the trigger's name. - */ -- (void)controlTextDidChange:(NSNotification *)notification -{ - [self _toggleConfirmAddTriggerButtonEnabled]; -} - /** * Toggles the enabled state of confirm add trigger button based on the editing of the trigger's statement. */ @@ -542,23 +510,68 @@ } #pragma mark - +#pragma mark Textfield delegate methods /** - * Dealloc. + * Toggles the enabled state of confirm add trigger button based on the editing of the trigger's name. */ -- (void)dealloc +- (void)controlTextDidChange:(NSNotification *)notification { - [triggerData release], triggerData = nil; - - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [[NSUserDefaults standardUserDefaults] removeObserver:self forKeyPath:SPUseMonospacedFonts]; - - [super dealloc]; + [self _toggleConfirmAddTriggerButtonEnabled]; } -@end +#pragma mark - +#pragma mark Private API -@implementation SPTableTriggers (PrivateAPI) +/** + * Presents the edit sheet for the trigger at the supplied index. + * + * @param index The index of the trigger to edit + */ +- (void)_editTriggerAtIndex:(NSInteger)index +{ + NSDictionary *trigger = [triggerData objectAtIndex:index]; + + // Cache the original trigger's name and statement in the event that the editing process fails and + // we need to recreate it. + editTriggerName = [trigger objectForKey:@"trigger"]; + editTriggerStatement = [trigger objectForKey:@"statement"]; + editTriggerTableName = [trigger objectForKey:@"table"]; + editTriggerEvent = [trigger objectForKey:@"event"]; + editTriggerActionTime = [trigger objectForKey:@"timing"]; + + [triggerNameTextField setStringValue:editTriggerName]; + [triggerStatementTextView setString:editTriggerStatement]; + + // Timin title is different then what we have saved in the database (case difference) + for (NSUInteger i = 0; i < [[triggerActionTimePopUpButton itemArray] count]; i++) + { + if ([[[triggerActionTimePopUpButton itemTitleAtIndex:i] uppercaseString] isEqualToString:[[trigger objectForKey:@"timing"] uppercaseString]]) { + [triggerActionTimePopUpButton selectItemAtIndex:i]; + break; + } + } + + // Event title is different then what we have saved in the database (case difference) + for (NSUInteger i = 0; i < [[triggerEventPopUpButton itemArray] count]; i++) + { + if ([[[triggerEventPopUpButton itemTitleAtIndex:i] uppercaseString] isEqualToString:[[trigger objectForKey:@"event"] uppercaseString]]) { + [triggerEventPopUpButton selectItemAtIndex:i]; + break; + } + } + + // Change button label from Add to Edit + [confirmAddTriggerButton setTitle:NSLocalizedString(@"Save", @"Save trigger button label")]; + + isEdit = YES; + + [NSApp beginSheet:addTriggerPanel + modalForWindow:[tableDocumentInstance parentWindow] + modalDelegate:self + didEndSelector:nil + contextInfo:nil]; +} /** * Enables or disables the confirm add trigger button based on the values of the trigger's name @@ -575,33 +588,48 @@ - (void)_refreshTriggerDataForcingCacheRefresh:(BOOL)clearAllCaches { [triggerData removeAllObjects]; - + if ([tablesListInstance tableType] == SPTableTypeTable) { - + if (clearAllCaches) { [tableDataInstance resetAllData]; [tableDataInstance updateTriggersForCurrentTable]; } - + NSArray *triggers = ([[tableDocumentInstance serverSupport] supportsTriggers]) ? [tableDataInstance triggers] : nil; - + for (NSDictionary *trigger in triggers) { [triggerData addObject:[NSDictionary dictionaryWithObjectsAndKeys: - [trigger objectForKey:@"Table"], @"table", - [trigger objectForKey:@"Trigger"], @"trigger", - [trigger objectForKey:@"Event"], @"event", - [trigger objectForKey:@"Timing"], @"timing", - [trigger objectForKey:@"Statement"], @"statement", - [trigger objectForKey:@"Definer"], @"definer", - [trigger objectForKey:@"Created"], @"created", - [trigger objectForKey:@"sql_mode"], @"sql_mode", - nil]]; - + [trigger objectForKey:@"Table"], @"table", + [trigger objectForKey:@"Trigger"], @"trigger", + [trigger objectForKey:@"Event"], @"event", + [trigger objectForKey:@"Timing"], @"timing", + [trigger objectForKey:@"Statement"], @"statement", + [trigger objectForKey:@"Definer"], @"definer", + [trigger objectForKey:@"Created"], @"created", + [trigger objectForKey:@"sql_mode"], @"sql_mode", + nil]]; + } } - + [triggersTableView reloadData]; } +#pragma mark - + +/** + * Dealloc. + */ +- (void)dealloc +{ + [triggerData release], triggerData = nil; + + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSUserDefaults standardUserDefaults] removeObserver:self forKeyPath:SPUseMonospacedFonts]; + + [super dealloc]; +} + @end -- cgit v1.2.3