Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 47 lines (38 sloc) 1.236 kB
058fbcf @pieter RefController: Refactor ref menu to its own class
authored
1 //
2 // PBRefMenuItem.m
3 // GitX
4 //
5 // Created by Pieter de Bie on 01-11-08.
6 // Copyright 2008 Pieter de Bie. All rights reserved.
7 //
8
9 #import "PBRefMenuItem.h"
10
11
12 @implementation PBRefMenuItem
13 @synthesize ref, commit;
14
15 + (NSArray *)defaultMenuItemsForRef:(PBGitRef *)ref commit:(PBGitCommit *)commit target:(id)target
16 {
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"])
22 type = @"branch";
23
24 [array addObject:[[PBRefMenuItem alloc] initWithTitle:[@"Delete " stringByAppendingString:type]
25 action:@selector(removeRef:)
26 keyEquivalent: @""]];
00e44b3 @pieter RefController: Allow checking out branches
authored
27 if ([type isEqualToString:@"branch"])
28 [array addObject:[[PBRefMenuItem alloc] initWithTitle:@"Checkout branch"
29 action:@selector(checkoutRef:)
30 keyEquivalent: @""]];
7e74efb Added very basic tag info menu item and alert.
Mike Czepiel authored
31
32 if ([type isEqualToString:@"tag"])
33 [array addObject:[[PBRefMenuItem alloc] initWithTitle:@"View tag info"
34 action:@selector(tagInfo:)
35 keyEquivalent: @""]];
058fbcf @pieter RefController: Refactor ref menu to its own class
authored
36
37 for (PBRefMenuItem *item in array)
38 {
39 [item setTarget: target];
40 [item setRef: ref];
41 [item setCommit:commit];
42 }
43
44 return array;
45 }
46 @end
Something went wrong with that request. Please try again.