5 // Created by Pieter de Bie on 01-11-08.
6 // Copyright 2008 Pieter de Bie. All rights reserved.
9 #import "PBRefMenuItem.h"
12 @implementation PBRefMenuItem
13 @synthesize ref, commit;
15 + (NSArray *)defaultMenuItemsForRef:(PBGitRef *)ref commit:(PBGitCommit *)commit target:(id)target
17 NSMutableArray *array = [NSMutableArray array];
18 NSString *type = [ref type];
19 if ([type isEqualToString:@"remote"])
20 type = @"remote branch";
21 else if ([type isEqualToString:@"head"])
24 [array addObject:[[PBRefMenuItem alloc] initWithTitle:[@"Delete " stringByAppendingString:type]
25 action:@selector(removeRef:)
27 if ([type isEqualToString:@"branch"])
28 [array addObject:[[PBRefMenuItem alloc] initWithTitle:@"Checkout branch"
29 action:@selector(checkoutRef:)
32 if ([type isEqualToString:@"tag"])
33 [array addObject:[[PBRefMenuItem alloc] initWithTitle:@"View tag info"
34 action:@selector(tagInfo:)
37 for (PBRefMenuItem *item in array)
39 [item setTarget: target];
41 [item setCommit:commit];