diff options
author | stuconnolly <stuart02@gmail.com> | 2009-07-02 00:39:49 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-07-02 00:39:49 +0000 |
commit | 33032bcebcf4254755db1b6d9b7cb51e806f2fc3 (patch) | |
tree | c635f6c363f1f42807a3af7472d1c4e1abd3efbf /Source | |
parent | 610f16d07ebfd9df2deb692afb5869b4ca408b69 (diff) | |
download | sequelpro-33032bcebcf4254755db1b6d9b7cb51e806f2fc3.tar.gz sequelpro-33032bcebcf4254755db1b6d9b7cb51e806f2fc3.tar.bz2 sequelpro-33032bcebcf4254755db1b6d9b7cb51e806f2fc3.zip |
Add contextual menus to table structure and table index views. Part of issue #139.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/TableSource.m | 23 |
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 |