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

(1 inline comment)

Much better. However, there is  a ClassCastException now (see my inline comment).

In addition, you might want to move the command implementations from the repository.tree package into the commands.shared package (and also use the abstract handler class there). I introduced this package to hold all command implementations that are not specific for the RepoView or Team context menu; feel free to add a "getRef()" method to the abstract class for later re-use.