diff options
author | stuconnolly <stuart02@gmail.com> | 2010-10-19 14:44:33 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-10-19 14:44:33 +0000 |
commit | d4ee9e678f07167536dc54f6dfd276864a41e5cf (patch) | |
tree | da2f88b8a21578cefda817ce044ecf492c1e0262 /Source/SPDatabaseDocument.m | |
parent | 7ff839a2d5cbcbf30e0f7bce17ce73f2dcd927ad (diff) | |
download | sequelpro-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/SPDatabaseDocument.m')
-rw-r--r-- | Source/SPDatabaseDocument.m | 36 |
1 files changed, 23 insertions, 13 deletions
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:)) { |