aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableSource.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/TableSource.m')
-rw-r--r--Source/TableSource.m23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 04441018..f29cc6f9 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -924,6 +924,29 @@ fetches the result as an array with a dictionary for each row in it
}
}
+/**
+ * Menu validation
+ */
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+ // Remove field
+ if ([menuItem action] == @selector(removeField:)) {
+ return (([tableSourceView numberOfSelectedRows] == 1) && ([tableSourceView numberOfRows] > 1));
+ }
+
+ // Duplicate field
+ if ([menuItem action] == @selector(copyField:)) {
+ return ([tableSourceView numberOfSelectedRows] == 1);
+ }
+
+ // Remove index
+ if ([menuItem action] == @selector(removeIndex:)) {
+ return ([indexView numberOfSelectedRows] == 1);
+ }
+
+ return [super validateMenuItem:menuItem];
+}
+
#pragma mark -
#pragma mark Getter methods