@@ -246,6 +246,19 @@ - (void)showInFinderAction:(id)sender
246
246
247
247
}
248
248
249
+ - (void )openFilesAction : (id )sender
250
+ {
251
+ NSString *workingDirectory = [[repository workingDirectory ] stringByAppendingString: @" /" ];
252
+ NSString *path;
253
+ NSWorkspace *ws = [NSWorkspace sharedWorkspace ];
254
+
255
+ for (NSString *filePath in [sender representedObject ]) {
256
+ path = [workingDirectory stringByAppendingPathComponent: filePath];
257
+ [ws openFile: path];
258
+ }
259
+ }
260
+
261
+
249
262
- (NSMenu *)contextMenuForTreeView
250
263
{
251
264
NSArray *filePaths = [[treeController selectedObjects ] valueForKey: @" fullPath" ];
@@ -259,14 +272,17 @@ - (NSMenu *)contextMenuForTreeView
259
272
- (NSArray *)menuItemsForPaths : (NSArray *)paths
260
273
{
261
274
BOOL multiple = [paths count ] != 1 ;
262
- NSMenuItem *finderItem = [[NSMenuItem alloc ] initWithTitle: multiple? @" Show items in Finder" : @" Show item in Finder"
263
- action: @selector (showInFinderAction: )
264
- keyEquivalent: @" " ];
265
275
NSMenuItem *historyItem = [[NSMenuItem alloc ] initWithTitle: multiple? @" Show history of files" : @" Show history of file"
266
276
action: @selector (showCommitsFromTree: )
267
277
keyEquivalent: @" " ];
278
+ NSMenuItem *finderItem = [[NSMenuItem alloc ] initWithTitle: @" Show in Finder"
279
+ action: @selector (showInFinderAction: )
280
+ keyEquivalent: @" " ];
281
+ NSMenuItem *openFilesItem = [[NSMenuItem alloc ] initWithTitle: multiple? @" Open Files" : @" Open File"
282
+ action: @selector (openFilesAction: )
283
+ keyEquivalent: @" " ];
268
284
269
- NSArray *menuItems = [NSArray arrayWithObjects: historyItem, finderItem, nil ];
285
+ NSArray *menuItems = [NSArray arrayWithObjects: historyItem, finderItem, openFilesItem, nil ];
270
286
for (NSMenuItem *item in menuItems) {
271
287
[item setTarget: self ];
272
288
[item setRepresentedObject: paths];
0 commit comments