aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableRelations.m15
-rw-r--r--Source/TableContent.m21
2 files changed, 36 insertions, 0 deletions
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m
index d3212a0e..a65de7ea 100644
--- a/Source/SPTableRelations.m
+++ b/Source/SPTableRelations.m
@@ -302,6 +302,21 @@
}
}
+/**
+ * Menu validation
+ */
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+ // Remove row
+ if ([menuItem action] == @selector(removeRelation:)) {
+ [menuItem setTitle:([relationsTableView numberOfSelectedRows] > 1) ? @"Delete Relations" : @"Delete Relation"];
+
+ return ([relationsTableView numberOfSelectedRows] > 0);
+ }
+
+ return [super validateMenuItem:menuItem];
+}
+
/*
* Dealloc.
*/
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 16f86ff1..9a96a28a 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -2550,6 +2550,27 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
[tableContentView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
}
}
+
+/**
+ * Menu validation
+ */
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+ // Remove row
+ if ([menuItem action] == @selector(removeRow:)) {
+ [menuItem setTitle:([tableContentView numberOfSelectedRows] > 1) ? @"Delete Rows" : @"Delete Row"];
+
+ return ([tableContentView numberOfSelectedRows] > 0);
+ }
+
+ // Duplicate row
+ if ([menuItem action] == @selector(copyRow:)) {
+ return ([tableContentView numberOfSelectedRows] == 1);
+ }
+
+ return [super validateMenuItem:menuItem];
+}
+
// Last but not least
- (void)dealloc
{