aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPIndexesController.h1
-rw-r--r--Source/SPIndexesController.m18
-rw-r--r--Source/SPTableStructure.m10
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)];
- }
}
/**