From c2854519c7b56e31a4e3cda90607dfe27f732b68 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 13 Jul 2008 19:36:10 -0400 Subject: [PATCH] Validate user interface items for the Debugger menu * Source/DebuggerWindowController.m: (init): Set self to be [self window]'s delegate (validateUserInterfaceItem:): New method --- Source/DebuggerWindowController.m | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index e904201..a1bdf82 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -42,6 +42,7 @@ session:[defaults stringForKey:@"IDEKey"]]; expandedRegisters = [[NSMutableSet alloc] init]; [[self window] makeKeyAndOrderFront:nil]; + [[self window] setDelegate:self]; } return self; } @@ -75,6 +76,21 @@ [[connection socket] close]; } +/** + * Validates the menu items for the "Debugger" menu + */ +- (BOOL)validateUserInterfaceItem:(id )anItem +{ + SEL action = [anItem action]; + + if (action == @selector(stepOut:)) + return ([connection isConnected] && [stack count] > 1); + else if (action == @selector(stepIn:) || action == @selector(stepOver:) || action == @selector(run:)) + return [connection isConnected]; + + return [[self window] validateUserInterfaceItem:anItem]; +} + /** * Resets all the displays to be empty */ -- 2.22.5