diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-06-15 08:05:26 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-06-15 08:05:26 +0000 |
commit | 52f9e54244e497919a130439d3cb498913df5f29 (patch) | |
tree | cdab00ef2fb65b2a0d723256d639f51393e5e860 /Source | |
parent | 64a31593840273a43349b642d08723fbbe88f2c4 (diff) | |
download | sequelpro-52f9e54244e497919a130439d3cb498913df5f29.tar.gz sequelpro-52f9e54244e497919a130439d3cb498913df5f29.tar.bz2 sequelpro-52f9e54244e497919a130439d3cb498913df5f29.zip |
• several fixes for index table in Structure view
- fixed binding for removeIndexButton
- moved indexTable's tableViewSelectionDidChange: delegate to SPIndexController to fix enabling/disabling of the removeIndexButton
- fixed issue to blank the index table for multiple selected tables
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPIndexesController.h | 1 | ||||
-rw-r--r-- | Source/SPIndexesController.m | 18 | ||||
-rw-r--r-- | Source/SPTableStructure.m | 10 |
3 files changed, 23 insertions, 6 deletions
diff --git a/Source/SPIndexesController.h b/Source/SPIndexesController.h index 9ceb6d9e..8fe7c88d 100644 --- a/Source/SPIndexesController.h +++ b/Source/SPIndexesController.h @@ -36,6 +36,7 @@ // Index table view IBOutlet NSTableView *indexesTableView; IBOutlet NSButton *addIndexButton; + IBOutlet NSButton *removeIndexButton; // New index sheet IBOutlet NSPopUpButton *indexTypePopUpButton; diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m index 0281d70e..819a8bc2 100644 --- a/Source/SPIndexesController.m +++ b/Source/SPIndexesController.m @@ -226,6 +226,24 @@ } #pragma mark - +#pragma mark TableView delegate methods + +/** + * Performs various interface validation + */ +- (void)tableViewSelectionDidChange:(NSNotification *)aNotification +{ + id object = [aNotification object]; + + if (object == indexesTableView) { + + // Check if there is currently an index selected and change button state accordingly + [removeIndexButton setEnabled:([indexesTableView numberOfSelectedRows] > 0 && [tablesList tableType] == SPTableTypeTable)]; + } + +} + +#pragma mark - #pragma mark Text field delegate methods /** diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index ab3e17a1..01b9cd5d 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -289,9 +289,12 @@ [removeIndexButton setEnabled:NO]; [editTableButton setEnabled:NO]; - // If no table is selected, refresh the table display to blank and return + // If no table is selected, refresh the table/index display to blank and return if (!selectedTable) { [tableSourceView reloadData]; + // Empty indexesController's fields and indices explicitly before reloading + [indexesController setFields:[NSArray array]]; + [indexesController setIndexes:[NSArray array]]; [indexesTableView reloadData]; return; } @@ -1452,11 +1455,6 @@ would result in a position change. [removeFieldButton setEnabled:NO]; } } - if (object == indexesTableView) { - - // Check if there is currently an index selected and change button state accordingly - [removeIndexButton setEnabled:([indexesTableView numberOfSelectedRows] > 0 && [tablesListInstance tableType] == SPTableTypeTable)]; - } } /** |