<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -203,6 +203,7 @@
 	[super removeView];
 }
 
+#pragma mark Table Column Methods
 - (NSMenu *)tableColumnMenu
 {
 	NSMenu *menu = [[NSMenu alloc] initWithTitle:@&quot;Table columns menu&quot;];
@@ -218,4 +219,76 @@
 	return menu;
 }
 
+#pragma mark Tree Context Menu Methods
+
+- (void)showCommitsFromTree:(id)sender
+{
+	// TODO: Enable this from webview as well!
+
+	NSMutableArray *filePaths = [NSMutableArray arrayWithObjects:@&quot;HEAD&quot;, @&quot;--&quot;, NULL];
+	[filePaths addObjectsFromArray:[sender representedObject]];
+
+	PBGitRevSpecifier *revSpec = [[PBGitRevSpecifier alloc] initWithParameters:filePaths];
+
+	repository.currentBranch = [repository addBranch:revSpec];
+}
+
+- (void)showInFinderAction:(id)sender
+{
+	NSString *workingDirectory = [[repository workingDirectory] stringByAppendingString:@&quot;/&quot;];
+	NSString *path;
+	NSWorkspace *ws = [NSWorkspace sharedWorkspace];
+
+	for (NSString *filePath in [sender representedObject]) {
+		path = [workingDirectory stringByAppendingPathComponent:filePath];
+		[ws selectFile: path inFileViewerRootedAtPath:path];
+	}
+
+}
+
+- (void)openFilesAction:(id)sender
+{
+	NSString *workingDirectory = [[repository workingDirectory] stringByAppendingString:@&quot;/&quot;];
+	NSString *path;
+	NSWorkspace *ws = [NSWorkspace sharedWorkspace];
+
+	for (NSString *filePath in [sender representedObject]) {
+		path = [workingDirectory stringByAppendingPathComponent:filePath];
+		[ws openFile:path];
+	}
+}
+
+
+- (NSMenu *)contextMenuForTreeView
+{
+	NSArray *filePaths = [[treeController selectedObjects] valueForKey:@&quot;fullPath&quot;];
+
+	NSMenu *menu = [[NSMenu alloc] init];
+	for (NSMenuItem *item in [self menuItemsForPaths:filePaths])
+		[menu addItem:item];
+	return menu;
+}
+
+- (NSArray *)menuItemsForPaths:(NSArray *)paths
+{
+	BOOL multiple = [paths count] != 1;
+	NSMenuItem *historyItem = [[NSMenuItem alloc] initWithTitle:multiple? @&quot;Show history of files&quot; : @&quot;Show history of file&quot;
+														 action:@selector(showCommitsFromTree:)
+												 keyEquivalent:@&quot;&quot;];
+	NSMenuItem *finderItem = [[NSMenuItem alloc] initWithTitle:@&quot;Show in Finder&quot;
+														action:@selector(showInFinderAction:)
+												 keyEquivalent:@&quot;&quot;];
+	NSMenuItem *openFilesItem = [[NSMenuItem alloc] initWithTitle:multiple? @&quot;Open Files&quot; : @&quot;Open File&quot;
+														   action:@selector(openFilesAction:)
+													keyEquivalent:@&quot;&quot;];
+
+	NSArray *menuItems = [NSArray arrayWithObjects:historyItem, finderItem, openFilesItem, nil];
+	for (NSMenuItem *item in menuItems) {
+		[item setTarget:self];
+		[item setRepresentedObject:paths];
+	}
+
+	return menuItems;
+}
+
 @end</diff>
      <filename>PBGitHistoryController.m</filename>
    </modified>
    <modified>
      <diff>@@ -2,14 +2,14 @@
 &lt;archive type=&quot;com.apple.InterfaceBuilder3.Cocoa.XIB&quot; version=&quot;7.03&quot;&gt;
 	&lt;data&gt;
 		&lt;int key=&quot;IBDocument.SystemTarget&quot;&gt;1050&lt;/int&gt;
-		&lt;string key=&quot;IBDocument.SystemVersion&quot;&gt;9G55&lt;/string&gt;
+		&lt;string key=&quot;IBDocument.SystemVersion&quot;&gt;9J61&lt;/string&gt;
 		&lt;string key=&quot;IBDocument.InterfaceBuilderVersion&quot;&gt;677&lt;/string&gt;
-		&lt;string key=&quot;IBDocument.AppKitVersion&quot;&gt;949.43&lt;/string&gt;
+		&lt;string key=&quot;IBDocument.AppKitVersion&quot;&gt;949.46&lt;/string&gt;
 		&lt;string key=&quot;IBDocument.HIToolboxVersion&quot;&gt;353.00&lt;/string&gt;
 		&lt;object class=&quot;NSMutableArray&quot; key=&quot;IBDocument.EditedObjectIDs&quot;&gt;
 			&lt;bool key=&quot;EncodedWithXMLCoder&quot;&gt;YES&lt;/bool&gt;
 			&lt;integer value=&quot;237&quot;/&gt;
-			&lt;integer value=&quot;27&quot;/&gt;
+			&lt;integer value=&quot;2&quot;/&gt;
 		&lt;/object&gt;
 		&lt;object class=&quot;NSArray&quot; key=&quot;IBDocument.PluginDependencies&quot;&gt;
 			&lt;bool key=&quot;EncodedWithXMLCoder&quot;&gt;YES&lt;/bool&gt;
@@ -345,6 +345,7 @@
 														&lt;object class=&quot;NSMutableArray&quot; key=&quot;set.sortedObjects&quot;&gt;
 															&lt;bool key=&quot;EncodedWithXMLCoder&quot;&gt;YES&lt;/bool&gt;
 															&lt;string&gt;Apple HTML pasteboard type&lt;/string&gt;
+															&lt;string&gt;Apple PDF pasteboard type&lt;/string&gt;
 															&lt;string&gt;Apple PICT pasteboard type&lt;/string&gt;
 															&lt;string&gt;Apple URL pasteboard type&lt;/string&gt;
 															&lt;string&gt;Apple Web Archive pasteboard type&lt;/string&gt;
@@ -355,6 +356,7 @@
 															&lt;string&gt;NeXT Rich Text Format v1.0 pasteboard type&lt;/string&gt;
 															&lt;string&gt;NeXT TIFF v4.0 pasteboard type&lt;/string&gt;
 															&lt;string&gt;WebURLsWithTitlesPboardType&lt;/string&gt;
+															&lt;string&gt;public.png&lt;/string&gt;
 															&lt;string&gt;public.url&lt;/string&gt;
 															&lt;string&gt;public.url-name&lt;/string&gt;
 														&lt;/object&gt;
@@ -2978,7 +2980,7 @@
 					&lt;/object&gt;
 					&lt;string&gt;com.apple.InterfaceBuilder.CocoaPlugin&lt;/string&gt;
 					&lt;string&gt;com.apple.InterfaceBuilder.CocoaPlugin&lt;/string&gt;
-					&lt;string&gt;{{321, 79}, {852, 432}}&lt;/string&gt;
+					&lt;string&gt;{{358, 67}, {852, 432}}&lt;/string&gt;
 					&lt;string&gt;com.apple.InterfaceBuilder.CocoaPlugin&lt;/string&gt;
 					&lt;string&gt;com.apple.InterfaceBuilder.CocoaPlugin&lt;/string&gt;
 					&lt;string&gt;com.apple.InterfaceBuilder.CocoaPlugin&lt;/string&gt;
@@ -3013,7 +3015,7 @@
 				&lt;/object&gt;
 			&lt;/object&gt;
 			&lt;nil key=&quot;sourceID&quot;/&gt;
-			&lt;int key=&quot;maxID&quot;&gt;274&lt;/int&gt;
+			&lt;int key=&quot;maxID&quot;&gt;286&lt;/int&gt;
 		&lt;/object&gt;
 		&lt;object class=&quot;IBClassDescriber&quot; key=&quot;IBDocument.Classes&quot;&gt;
 			&lt;object class=&quot;NSMutableArray&quot; key=&quot;referencedPartialClassDescriptions&quot;&gt;
@@ -3032,7 +3034,7 @@
 						&lt;object class=&quot;NSMutableArray&quot; key=&quot;dict.values&quot;&gt;
 							&lt;bool key=&quot;EncodedWithXMLCoder&quot;&gt;YES&lt;/bool&gt;
 							&lt;string&gt;PBGitHistoryController&lt;/string&gt;
-							&lt;string&gt;id&lt;/string&gt;
+							&lt;string&gt;PBWebHistoryController&lt;/string&gt;
 							&lt;string&gt;WebView&lt;/string&gt;
 						&lt;/object&gt;
 					&lt;/object&gt;
@@ -3053,6 +3055,8 @@
 							&lt;string&gt;setDetailedView:&lt;/string&gt;
 							&lt;string&gt;setRawView:&lt;/string&gt;
 							&lt;string&gt;setTreeView:&lt;/string&gt;
+							&lt;string&gt;showCommitsFromTree:&lt;/string&gt;
+							&lt;string&gt;showInFinderAction:&lt;/string&gt;
 							&lt;string&gt;toggleQuickView:&lt;/string&gt;
 						&lt;/object&gt;
 						&lt;object class=&quot;NSMutableArray&quot; key=&quot;dict.values&quot;&gt;
@@ -3063,6 +3067,8 @@
 							&lt;string&gt;id&lt;/string&gt;
 							&lt;string&gt;id&lt;/string&gt;
 							&lt;string&gt;id&lt;/string&gt;
+							&lt;string&gt;id&lt;/string&gt;
+							&lt;string&gt;id&lt;/string&gt;
 						&lt;/object&gt;
 					&lt;/object&gt;
 					&lt;object class=&quot;NSMutableDictionary&quot; key=&quot;outlets&quot;&gt;
@@ -3073,6 +3079,7 @@
 							&lt;string&gt;commitList&lt;/string&gt;
 							&lt;string&gt;fileBrowser&lt;/string&gt;
 							&lt;string&gt;searchField&lt;/string&gt;
+							&lt;string&gt;treeContextMenu&lt;/string&gt;
 							&lt;string&gt;treeController&lt;/string&gt;
 							&lt;string&gt;webView&lt;/string&gt;
 						&lt;/object&gt;
@@ -3082,6 +3089,7 @@
 							&lt;string&gt;NSTableView&lt;/string&gt;
 							&lt;string&gt;NSOutlineView&lt;/string&gt;
 							&lt;string&gt;NSSearchField&lt;/string&gt;
+							&lt;string&gt;NSMenu&lt;/string&gt;
 							&lt;string&gt;NSTreeController&lt;/string&gt;
 							&lt;string&gt;id&lt;/string&gt;
 						&lt;/object&gt;</diff>
      <filename>PBGitHistoryView.xib</filename>
    </modified>
    <modified>
      <diff>@@ -58,6 +58,25 @@
 	return fileNames;
 }
 
+- (NSMenu *)menuForEvent:(NSEvent *)theEvent
+{
+	if ([theEvent type] == NSRightMouseDown)
+	{
+		// get the current selections for the outline view.
+		NSIndexSet *selectedRowIndexes = [self selectedRowIndexes];
+
+		// select the row that was clicked before showing the menu for the event
+		NSPoint mousePoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
+		int row = [self rowAtPoint:mousePoint];
+
+		// figure out if the row that was just clicked on is currently selected
+		if ([selectedRowIndexes containsIndex:row] == NO)
+			[self selectRow:row byExtendingSelection:NO];
+	}
+
+	return [controller contextMenuForTreeView];
+}
+
 /* Implemented to satisfy datasourcee protocol */
 - (BOOL) outlineView: (NSOutlineView *)ov
          isItemExpandable: (id)item { return NO; }</diff>
      <filename>PBQLOutlineView.m</filename>
    </modified>
    <modified>
      <diff>@@ -76,21 +76,23 @@ contextMenuItemsForElement:(NSDictionary *)element
 {
 	DOMNode *node = [element valueForKey:@&quot;WebElementDOMNode&quot;];
 
-	// If clicked on the text, select the containing div
-	if ([[node className] isEqualToString:@&quot;DOMText&quot;])
-		node = [node parentNode];
-
-	// Every ref has a class name of 'refs' and some other class. We check on that to see if we pressed on a ref.
-	if (![[node className] hasPrefix:@&quot;refs &quot;])
-		return defaultMenuItems;
+	while (node) {
+		// Every ref has a class name of 'refs' and some other class. We check on that to see if we pressed on a ref.
+		if ([[node className] hasPrefix:@&quot;refs &quot;]) {
+			NSString *selectedRefString = [[[node childNodes] item:0] textContent];
+			for (PBGitRef *ref in historyController.webCommit.refs)
+			{
+				if ([[ref shortName] isEqualToString:selectedRefString])
+					return [contextMenuDelegate menuItemsForRef:ref commit:historyController.webCommit];
+			}
+			NSLog(@&quot;Could not find selected ref!&quot;);
+			return defaultMenuItems;
+		}
+		if ([node hasAttributes] &amp;&amp; [[node attributes] getNamedItem:@&quot;representedFile&quot;])
+			return [historyController menuItemsForPaths:[NSArray arrayWithObject:[[[node attributes] getNamedItem:@&quot;representedFile&quot;] value]]];
 
-	NSString *selectedRefString = [[[node childNodes] item:0] textContent];
-	for (PBGitRef *ref in historyController.webCommit.refs)
-	{
-		if ([[ref shortName] isEqualToString:selectedRefString])
-			return [contextMenuDelegate menuItemsForRef:ref commit:historyController.webCommit];
+		node = [node parentNode];
 	}
-	NSLog(@&quot;Could not find selected ref!&quot;);
 
 	return defaultMenuItems;
 }</diff>
      <filename>PBWebHistoryController.m</filename>
    </modified>
    <modified>
      <diff>@@ -205,26 +205,32 @@ var showDiff = function() {
 		var link = document.createElement(&quot;a&quot;);
 		link.setAttribute(&quot;href&quot;, &quot;#&quot; + id);
 		p.appendChild(link);
-		var buttonType = &quot;&quot;
+		var buttonType = &quot;&quot;;
+		var finalFile = &quot;&quot;;
 		if (name1 == name2) {
 			buttonType = &quot;changed&quot;
-			link.appendChild(document.createTextNode(name1));
+			finalFile = name1;
 			if (mode_change)
 				p.appendChild(document.createTextNode(&quot; mode &quot; + old_mode + &quot; -&gt; &quot; + new_mode));
 		}
 		else if (name1 == &quot;/dev/null&quot;) {
 			buttonType = &quot;created&quot;;
-			link.appendChild(document.createTextNode(name2));
+			finalFile = name2;
 		}
 		else if (name2 == &quot;/dev/null&quot;) {
 			buttonType = &quot;deleted&quot;;
-			link.appendChild(document.createTextNode(name1));
+			finalFile = name1;
 		}
 		else {
 			buttonType = &quot;renamed&quot;;
-			link.appendChild(document.createTextNode(name2));
+			finalFile = name2;
 			p.insertBefore(document.createTextNode(name1 + &quot; -&gt; &quot;), link);
 		}
+
+		link.appendChild(document.createTextNode(finalFile));
+		button.setAttribute(&quot;representedFile&quot;, finalFile);
+		link.setAttribute(&quot;representedFile&quot;, finalFile);
+
 		button.setAttribute(&quot;class&quot;, &quot;button &quot; + buttonType);
 		button.appendChild(document.createTextNode(buttonType));
 		$(&quot;files&quot;).appendChild(button);</diff>
      <filename>html/views/history/history.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a03401dd51cccd5c8ea191016f7cc149143fb7bd</id>
    </parent>
    <parent>
      <id>7427cbe05d1d96490c18d642d5ea613d0f8b4caf</id>
    </parent>
  </parents>
  <author>
    <name>Pieter de Bie</name>
    <email>frimmirf+gitx@gmail.com</email>
  </author>
  <url>http://github.com/pieter/gitx/commit/64182ea911dd22dbe0adaac667a5486685478407</url>
  <id>64182ea911dd22dbe0adaac667a5486685478407</id>
  <committed-date>2009-06-20T14:28:19-07:00</committed-date>
  <authored-date>2009-06-20T14:28:19-07:00</authored-date>
  <message>Merge commit 'origin/jg/tree_context'

* commit 'origin/jg/tree_context':
  HistoryController: Add &quot;Open Files&quot; menu item
  WebHistoryView: Also use the tree context menu
  HistoryController: Use a programatically created context menu
  WebHistoryController: Refactor menu search to be recursive
  HistoryController: Add some marks
  PBGitHistory: Add &quot;Show in Finder&quot; to files
  Display context menu in the history tree to show related commits
  History fileview: select current item on rightclick</message>
  <tree>8cbed2803a84f6af495e2579dfe3522668884ec6</tree>
  <committer>
    <name>Pieter de Bie</name>
    <email>frimmirf+gitx@gmail.com</email>
  </committer>
</commit>
