aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-23 11:34:16 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-23 11:34:16 +0000
commit6d72a0d3c3a047ce952e0e78a1e5232eb7f15be3 (patch)
tree3e67593755e83018f9fcef529f30299d6763ee7f
parent331d5f6d8a9bbb16089da8522d97d584e9921d73 (diff)
downloadsequelpro-6d72a0d3c3a047ce952e0e78a1e5232eb7f15be3.tar.gz
sequelpro-6d72a0d3c3a047ce952e0e78a1e5232eb7f15be3.tar.bz2
sequelpro-6d72a0d3c3a047ce952e0e78a1e5232eb7f15be3.zip
• TablesList
- method selectTableOrViewWithName: scrolls to selected item • Navigator - double-click at db/table/view/field selects the chosen schema path in active connection window if chosen schema path and active connection window have the same connection ID
-rw-r--r--Source/SPNavigatorController.m40
-rw-r--r--Source/TablesList.m3
2 files changed, 40 insertions, 3 deletions
diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m
index 21389757..a9ce93c8 100644
--- a/Source/SPNavigatorController.m
+++ b/Source/SPNavigatorController.m
@@ -28,8 +28,10 @@
#import "SPConstants.h"
#import "ImageAndTextCell.h"
#import "TableDocument.h"
+#import "TablesList.h"
#import "SPArrayAdditions.h"
#import "SPLogger.h"
+#import "SPTooltip.h"
static SPNavigatorController *sharedNavigatorController = nil;
@@ -630,7 +632,9 @@ static SPNavigatorController *sharedNavigatorController = nil;
return NO;
return YES;
}
-
+/*
+ * Double-click on item selects the chosen path in active connection window
+ */
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
if([outlineView levelForItem:item] == 0) return NO;
@@ -638,13 +642,45 @@ static SPNavigatorController *sharedNavigatorController = nil;
id parentObject = [outlineView parentForItem:item] ? [outlineView parentForItem:item] : schemaData;
id parentKeys = [parentObject allKeysForObject:item];
if(parentKeys && [parentKeys count] == 1) {
+
+ NSPoint pos = [NSEvent mouseLocation];
+ pos.y -= 20;
+
+ // Do not allow to double-click at PROCs and FUNCs since it doesn't make sense
+ if([item isKindOfClass:[NSDictionary class]] && [item objectForKey:@" struct_type "] && [[item objectForKey:@" struct_type "] intValue] > 1) {
+ [SPTooltip showWithObject:NSLocalizedString(@"You only can select tables or views.", @"you only can select tables or views tooltip")
+ atLocation:pos
+ ofType:@"text"];
+ return NO;
+ }
+
NSArray *pathArray = [[[parentKeys objectAtIndex:0] description] componentsSeparatedByString:SPUniqueSchemaDelimiter];
if([pathArray count] > 1) {
+
TableDocument *doc = [[NSDocumentController sharedDocumentController] currentDocument];
+ if([doc isWorking]) {
+ [SPTooltip showWithObject:NSLocalizedString(@"Active connection window is busy. Please wait and try again.", @"active connection window is busy. please wait and try again. tooltip")
+ atLocation:pos
+ ofType:@"text"];
+ return NO;
+ }
if([[doc connectionID] isEqualToString:[pathArray objectAtIndex:0]]) {
+
+ // select db
if(![[doc database] isEqualToString:[pathArray objectAtIndex:1]]) {
- // todo
+ if([[doc valueForKeyPath:@"mySQLConnection"] isConnected]) {
+ [[doc valueForKeyPath:@"chooseDatabaseButton"] selectItemWithTitle:[pathArray objectAtIndex:1]];
+ [doc chooseDatabase:self];
+ }
}
+ // select table/view if given
+ if([pathArray count] > 2)
+ [[doc valueForKeyPath:@"tablesListInstance"] performSelector:@selector(selectTableOrViewWithName:) withObject:[pathArray objectAtIndex:2] afterDelay:0.1];
+
+ } else {
+ [SPTooltip showWithObject:NSLocalizedString(@"The connection of the active connection window is not identical.", @"the connection of the active connection window is not identical tooltip")
+ atLocation:pos
+ ofType:@"text"];
}
}
}
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 6de845f3..03454e80 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -1234,6 +1234,7 @@
[self updateSelectionWithTaskString:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), theName]];
}
}
+ [tablesListView scrollRowToVisible:[tablesListView selectedRow]];
return YES;
}
@@ -1422,7 +1423,7 @@
tableName = [filteredTables objectAtIndex:[tablesListView selectedRow]];
[self updateSelectionWithTaskString:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), tableName]];
- if([[SPNavigatorController sharedNavigatorController] syncMode]) {
+ if([[SPNavigatorController sharedNavigatorController] syncMode] && [tablesListView numberOfSelectedRows] == 1) {
NSMutableString *schemaPath = [NSMutableString string];
[schemaPath setString:[tableDocumentInstance connectionID]];
if([tableDocumentInstance database] && [[tableDocumentInstance database] length]) {