Index: GWLib/BIcon.h =================================================================== RCS file: /cvsroot/GW/gworkspace/GWLib/BIcon.h,v retrieving revision 1.4 diff -u -r1.4 BIcon.h --- GWLib/BIcon.h 25 Jan 2003 11:30:28 -0000 1.4 +++ GWLib/BIcon.h 6 Apr 2003 13:06:31 -0000 @@ -117,6 +117,7 @@ - (NSSize)iconShift; +-(void)openWithApp:(id)sender; @end Index: GWLib/BIcon.m =================================================================== RCS file: /cvsroot/GW/gworkspace/GWLib/BIcon.m,v retrieving revision 1.11 diff -u -r1.11 BIcon.m --- GWLib/BIcon.m 13 Mar 2003 11:28:24 -0000 1.11 +++ GWLib/BIcon.m 6 Apr 2003 13:06:31 -0000 @@ -467,6 +467,43 @@ } } +-(NSMenu *) menuForEvent:(NSEvent*)theEvent +{ +NSDictionary *apps = [[GWLib sharedWorkspace] infoForExtension: [name pathExtension]]; +NSEnumerator *app_enum; +NSMenu *menu; +NSMenuItem *menuItem; +id key; +menu = [[NSMenu alloc] initWithTitle:@"Open with"]; +app_enum = [[apps allKeys] objectEnumerator]; + while ((key = [app_enum nextObject])) { + menuItem = [[NSMenuItem alloc] init]; + [menuItem setTitle: [NSString stringWithFormat: @"%@ - %@", + [key description], + [[apps objectForKey: key] objectForKey: @"NSRole"]]]; + + [menuItem setAction: @selector(openWithApp:)]; + [menuItem setRepresentedObject:[NSDictionary dictionaryWithObjectsAndKeys:[key description], @"appName", fullpath,@"fullPath",nil]]; + [menuItem setTarget: self]; + [menu addItem: menuItem]; + [menuItem release]; + } +[self setMenu: menu]; +[menu release]; +return [self menu]; +} + +-(void)openWithApp:(id)sender +{ +NSString *appName; +NSString *fullPath; + +appName = [[sender representedObject] objectForKey: @"appName"]; +fullPath = [[sender representedObject] objectForKey: @"fullPath"]; +[[GWLib sharedWorkspace] openFile:fullPath withApplication:appName]; + +} + @end