aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDatabaseDocument.m22
1 files changed, 16 insertions, 6 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 42d42931..21d5034a 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -3522,15 +3522,25 @@
NSInteger tag = [menuItem tag];
NSInteger type = [tablesListInstance tableType];
+ NSInteger numberOfSelectedItems = [[[tablesListInstance valueForKeyPath:@"tablesListView"] selectedRowIndexes] count];
- BOOL enable = (([self database] != nil) && ([[[tablesListInstance valueForKeyPath:@"tablesListView"] selectedRowIndexes] count]));
+ BOOL enable = (([self database] != nil) && numberOfSelectedItems);
- if (type == SPTableTypeTable) {
- return enable;
- }
- else if ((type == SPTableTypeProc) || (type == SPTableTypeFunc)) {
+ // Enable all export formats if at least one table/view is selected
+ if (numberOfSelectedItems == 1) {
+ if (type == SPTableTypeTable || type == SPTableTypeView) {
+ return enable;
+ }
+ 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;
+
return (enable && (tag == SPSQLExport));
- }
+ }
}
if ([menuItem action] == @selector(import:) ||