Revision: 28999 http://sourceforge.net/p/bibdesk/svn/28999 Author: hofman Date: 2025-02-07 17:02:09 +0000 (Fri, 07 Feb 2025) Log Message: ----------- implement validateUserInterfaceItem: instead of validateMenuItem: in NSTableView subclasses, as that is implemented in the base class
Modified Paths: -------------- trunk/bibdesk/BDSKMainTableView.m trunk/bibdesk/BDSKOutlineView.m trunk/bibdesk/BDSKTableView.m Modified: trunk/bibdesk/BDSKMainTableView.m =================================================================== --- trunk/bibdesk/BDSKMainTableView.m 2025-02-07 15:08:22 UTC (rev 28998) +++ trunk/bibdesk/BDSKMainTableView.m 2025-02-07 17:02:09 UTC (rev 28999) @@ -637,18 +637,18 @@ } } -- (BOOL)validateMenuItem:(NSMenuItem *)menuItem{ - SEL action = [menuItem action]; +- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { + SEL action = [item action]; if (action == @selector(alternateDelete:)) return [self canAlternateDelete]; else if (action == @selector(alternateCut:)) return [self canAlternateCut]; else if (action == @selector(columnsMenuSelectTableColumn:)) - return ([[menuItem representedObject] isEqualToString:BDSKImportOrderString] == NO && [[menuItem representedObject] isEqualToString:BDSKRelevanceString] == NO && [self numberOfColumns] > 1); + return ([[(NSMenuItem *)item representedObject] isEqualToString:BDSKImportOrderString] == NO && [[(NSMenuItem *)item representedObject] isEqualToString:BDSKRelevanceString] == NO && [self numberOfColumns] > 1); else if (action == @selector(columnsMenuAddTableColumn:)) return YES; else - return [super validateMenuItem:menuItem]; + return [super validateUserInterfaceItem:item]; } // override private method from OmniAppKit/NSTableView-OAColumnConfigurationExtensions Modified: trunk/bibdesk/BDSKOutlineView.m =================================================================== --- trunk/bibdesk/BDSKOutlineView.m 2025-02-07 15:08:22 UTC (rev 28998) +++ trunk/bibdesk/BDSKOutlineView.m 2025-02-07 17:02:09 UTC (rev 28999) @@ -442,27 +442,27 @@ return [super dragImageForRowsWithIndexes:dragRows tableColumns:tableColumns event:dragEvent offset:dragImageOffset]; } -- (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - if ([menuItem action] == @selector(delete:)) +- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { + if ([item action] == @selector(delete:)) return [self canDelete]; - else if ([menuItem action] == @selector(copy:)) + else if ([item action] == @selector(copy:)) return [self canCopy]; - else if ([menuItem action] == @selector(cut:)) + else if ([item action] == @selector(cut:)) return [self canCut]; - else if ([menuItem action] == @selector(paste:)) + else if ([item action] == @selector(paste:)) return [self canPaste]; - else if ([menuItem action] == @selector(duplicate:)) + else if ([item action] == @selector(duplicate:)) return [self canDuplicate]; - else if ([menuItem action] == @selector(selectAll:)) + else if ([item action] == @selector(selectAll:)) return [self allowsMultipleSelection]; - else if ([menuItem action] == @selector(deselectAll:)) + else if ([item action] == @selector(deselectAll:)) return [self allowsEmptySelection]; - else if ([menuItem action] == @selector(insertNewline:)) + else if ([item action] == @selector(insertNewline:)) return [[self delegate] respondsToSelector:@selector(outlineViewInsertNewline:)]; - else if ([menuItem action] == @selector(invertSelection:)) + else if ([item action] == @selector(invertSelection:)) return [self allowsMultipleSelection]; - else if ([[BDSKOutlineView superclass] instancesRespondToSelector:@selector(validateMenuItem:)]) - return [super validateMenuItem:menuItem]; + else if ([[BDSKOutlineView superclass] instancesRespondToSelector:_cmd]) + return [super validateUserInterfaceItem:item]; else return YES; } Modified: trunk/bibdesk/BDSKTableView.m =================================================================== --- trunk/bibdesk/BDSKTableView.m 2025-02-07 15:08:22 UTC (rev 28998) +++ trunk/bibdesk/BDSKTableView.m 2025-02-07 17:02:09 UTC (rev 28999) @@ -423,33 +423,33 @@ return [super dragImageForRowsWithIndexes:dragRows tableColumns:tableColumns event:dragEvent offset:dragImageOffset]; } -- (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - if ([menuItem action] == @selector(delete:)) +- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { + if ([item action] == @selector(delete:)) return [self canDelete]; - else if ([menuItem action] == @selector(copy:)) + else if ([item action] == @selector(copy:)) return [self canCopy]; - else if ([menuItem action] == @selector(cut:)) + else if ([item action] == @selector(cut:)) return [self canCut]; - else if ([menuItem action] == @selector(paste:)) + else if ([item action] == @selector(paste:)) return [self canPaste]; - else if ([menuItem action] == @selector(duplicate:)) + else if ([item action] == @selector(duplicate:)) return [self canDuplicate]; - else if ([menuItem action] == @selector(selectAll:)) + else if ([item action] == @selector(selectAll:)) return [self allowsMultipleSelection]; - else if ([menuItem action] == @selector(deselectAll:)) + else if ([item action] == @selector(deselectAll:)) return [self allowsEmptySelection]; - else if ([menuItem action] == @selector(insertNewlineIgnoringFieldEditor:)) + else if ([item action] == @selector(insertNewlineIgnoringFieldEditor:)) return [[self delegate] respondsToSelector:@selector(tableViewInsertNewlineIgnoringFieldEditor:)]; - else if ([menuItem action] == @selector(insertNewline:)) + else if ([item action] == @selector(insertNewline:)) return [[self delegate] respondsToSelector:@selector(tableViewInsertNewline:)]; - else if ([menuItem action] == @selector(insertSpace:)) + else if ([item action] == @selector(insertSpace:)) return [[self delegate] respondsToSelector:@selector(tableViewInsertSpace:)]; - else if ([menuItem action] == @selector(insertShiftSpace:)) + else if ([item action] == @selector(insertShiftSpace:)) return [[self delegate] respondsToSelector:@selector(tableViewInsertShiftSpace:)]; - else if ([menuItem action] == @selector(invertSelection:)) + else if ([item action] == @selector(invertSelection:)) return [self allowsMultipleSelection]; - else if ([[BDSKTableView superclass] instancesRespondToSelector:@selector(validateMenuItem:)]) - return [super validateMenuItem:menuItem]; + else if ([[BDSKTableView superclass] instancesRespondToSelector:_cmd]) + return [super validateUserInterfaceItem:item]; else return YES; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit