aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-10-19 14:44:33 +0000
committerstuconnolly <stuart02@gmail.com>2010-10-19 14:44:33 +0000
commitd4ee9e678f07167536dc54f6dfd276864a41e5cf (patch)
treeda2f88b8a21578cefda817ce044ecf492c1e0262 /Source
parent7ff839a2d5cbcbf30e0f7bce17ce73f2dcd927ad (diff)
downloadsequelpro-d4ee9e678f07167536dc54f6dfd276864a41e5cf.tar.gz
sequelpro-d4ee9e678f07167536dc54f6dfd276864a41e5cf.tar.bz2
sequelpro-d4ee9e678f07167536dc54f6dfd276864a41e5cf.zip
Add a 'Refresh Tables' menu item to the 'Database' menu. It currently has the shortcut Ctrl+Cmd+R, but this can always be remapped in system preferences. Implemented issue #845.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDatabaseDocument.h1
-rw-r--r--Source/SPDatabaseDocument.m36
2 files changed, 24 insertions, 13 deletions
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index c2cf0e85..3bb74e72 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -215,6 +215,7 @@
- (void)selectDatabase:(NSString *)aDatabase item:(NSString *)anItem;
- (IBAction)addDatabase:(id)sender;
- (IBAction)removeDatabase:(id)sender;
+- (IBAction)refreshTables:(id)sender;
- (IBAction)copyDatabase:(id)sender;
- (IBAction)renameDatabase:(id)sender;
- (IBAction)showMySQLHelp:(id)sender;
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index bd5ee773..4e598866 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -1071,6 +1071,14 @@
}
/**
+ * Refreshes the tables list by calling SPTablesList's updateTables.
+ */
+- (IBAction)refreshTables:(id)sender
+{
+ [tablesListInstance updateTables:self];
+}
+
+/**
* Displays the database server variables sheet.
*/
- (IBAction)showServerVariables:(id)sender
@@ -3589,19 +3597,22 @@
else if ((type == SPTableTypeProc) || (type == SPTableTypeFunc)) {
return (enable && (tag == SPSQLExport));
}
- } else {
- for(NSNumber *type in [tablesListInstance selectedTableTypes])
- if([type intValue] == SPTableTypeTable || [type intValue] == SPTableTypeView)
- return enable;
-
+ }
+ else {
+ for (NSNumber *type in [tablesListInstance selectedTableTypes])
+ {
+ if ([type intValue] == SPTableTypeTable || [type intValue] == SPTableTypeView) return enable;
+ }
+
return (enable && (tag == SPSQLExport));
}
}
- if ([menuItem action] == @selector(import:) ||
+ if ([menuItem action] == @selector(import:) ||
[menuItem action] == @selector(removeDatabase:) ||
- [menuItem action] == @selector(copyDatabase:) ||
- [menuItem action] == @selector(renameDatabase:))
+ [menuItem action] == @selector(copyDatabase:) ||
+ [menuItem action] == @selector(renameDatabase:) ||
+ [menuItem action] == @selector(refreshTables:))
{
return ([self database] != nil);
}
@@ -3628,12 +3639,11 @@
}
if ([menuItem action] == @selector(printDocument:)) {
- return (([self database] != nil && [[tablesListInstance valueForKeyPath:@"tablesListView"] numberOfSelectedRows] == 1)
- // if Custom Query Tab is active the textView will handle printDocument by itself
+ return (([self database] != nil && [[tablesListInstance valueForKeyPath:@"tablesListView"] numberOfSelectedRows] == 1) ||
+ // If Custom Query Tab is active the textView will handle printDocument by itself
// if it is first responder; otherwise allow to print the Query Result table even
- //if no db/table is selected
- || [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 2
- );
+ // if no db/table is selected
+ [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 2);
}
if ([menuItem action] == @selector(chooseEncoding:)) {