aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TablesList.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-07-18 16:02:04 +0000
committerrowanbeentje <rowan@beent.je>2009-07-18 16:02:04 +0000
commit11e10321f97577204b74f84b528029490e64ef47 (patch)
tree624f2897d1937f02996471b681a485d6358a8535 /Source/TablesList.m
parent4aa27ac121818e97bb70f28943d11590226a64ce (diff)
downloadsequelpro-11e10321f97577204b74f84b528029490e64ef47.tar.gz
sequelpro-11e10321f97577204b74f84b528029490e64ef47.tar.bz2
sequelpro-11e10321f97577204b74f84b528029490e64ef47.zip
Add the ability to navigate between tables via foreign key relationships, addressing the first part of #209:
- For the first column linked by each foreign key, display a link arrow within the table cell - When clicking on the link arrow, select the reference table and set the table filters to select the clicked value - Also uses the table cell subclass to allow the entire cell to be editable, not just the contained text (addresses #250)
Diffstat (limited to 'Source/TablesList.m')
-rw-r--r--Source/TablesList.m24
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 49b97008..bba94272 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -1051,6 +1051,30 @@
statusLoaded = !reload;
}
+/**
+ * Select a table or view using the provided name; returns YES if the
+ * supplied name could be selected, or NO if not.
+ */
+- (BOOL)selectTableOrViewWithName:(NSString *)theName
+{
+ int i, tableType, itemIndex = NSNotFound;
+
+ // Loop through the tables/views to find the desired item
+ for (i = 0; i < [tables count]; i++) {
+ tableType = [[tableTypes objectAtIndex:i] intValue];
+ if (tableType != SP_TABLETYPE_TABLE && tableType != SP_TABLETYPE_VIEW) continue;
+ if ([[tables objectAtIndex:i] isEqualToString:theName]) {
+ itemIndex = i;
+ break;
+ }
+ }
+
+ if (itemIndex == NSNotFound) return NO;
+
+ [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO];
+ return YES;
+}
+
#pragma mark Datasource methods
/**