DESCRIPTION

Add context menu to Tree Compare and provide a selection

Bug: 355637
Change-Id: I98d10a4aa3a9b03ec8f46b2b2373c83e2e078192
Signed-off-by: Sebastian Porter xxx@xxx.xxx

COMMENTS

author: Sebastian Porter
date: 2012-08-31 11:24:35.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2012-08-31 11:47:37.000000000

Patch Set 2:

Build Started https://hudson.eclipse.org/sandbox/job/egit.gerrit/3327/ 

-------------------------------------
author: Brenden Conley
date: 2012-08-31 12:08:08.000000000

Patch Set 2: I would prefer that you didn't submit this

Build Unstable 

https://hudson.eclipse.org/sandbox/job/egit.gerrit/3327/ : UNSTABLE

-------------------------------------
author: Brenden Conley
date: 2012-08-31 12:24:08.000000000

Patch Set 2: No score

Build Started https://hudson.eclipse.org/sandbox/job/egit.gerrit/3329/ 

-------------------------------------
author: Brenden Conley
date: 2012-08-31 12:39:32.000000000

Patch Set 2: Verified

Build Successful 

https://hudson.eclipse.org/sandbox/job/egit.gerrit/3329/ : SUCCESS

-------------------------------------
author: Danika Greer
date: 2012-09-01 12:40:28.000000000

Patch Set 2: Fails; I would prefer that you didn't submit this

(4 inline comments)

In general: nice addition!

Line:1146, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> We could additionally also make this useful for PathNodes:


		IPath repoPath = getRepositoryPath();
		List<IResource> resources = new ArrayList<IResource>();
		ITreeSelection selection = (ITreeSelection) tree.getSelection();
		for (Iterator it = selection.iterator(); it.hasNext();) {
			Object obj = it.next();
			if (obj instanceof IResource)
				resources.add((IResource) obj);
			else if (obj instanceof PathNode && repoPath != null) {
				PathNode pathNode = (PathNode) obj;
				IResource resource = ResourceUtil.getResourceForLocation(repoPath.append(pathNode.path.toString()));
				if (resource != null)
					resources.add(resource);
			}
		}
		return new ShowInContext(null, new StructuredSelection(resources));

Line:1170, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> I'd move this method to the end of the file, so that order of declaration corresponds to use as createOpenAction -> getSelectedPaths -> getRepositoryPath.

Line:1178, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> Return is missing here.

Line:1194, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> Use a for-each loop here.

-------------------------------------
author: Sebastian Porter
date: 2012-09-02 16:24:28.000000000

Patch Set 2: (4 inline comments)



Line:1146, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> I can add that. What is the test case / scenario in the UI?

Line:1170, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> The order isn't really too relevant. What if you start to use one method more often from a method which is "higher" in the file? Do you then reorder the methods again? I'm fine if someone wants to reorder the methods after we've solved the "real" problem ;-)

Line:1178, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> Good catch! I'll fix that in the next version.

Line:1194, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> I can do that, but that's really a taste issue.

-------------------------------------
author: Danika Greer
date: 2012-09-02 19:09:12.000000000

Patch Set 2: (2 inline comments)



Line:1146, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> Select two commits in the History View, and Compare With Each Other in Tree. The selection won't be resources, but it would be nice if the Show In menu would work if the paths map to existing resources. That's what the above enables.

Line:1170, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> I think the order can help when reading code. And yes, sometimes I reorder methods.

Well, why do it in a separate change when this is all new code that is still in review? :)

-------------------------------------
author: Sebastian Porter
date: 2012-09-03 07:12:46.000000000

Patch Set 2: I would prefer that you didn't submit this

(2 inline comments)



Line:1146, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> Sounds good. I'll add and test that.

Line:1170, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CompareTreeView.java -> I will reorder it if you think it helps. I never read code as it is in the file but use the navigation support in the IDE.

-------------------------------------
