eclipsesource / megit

Standalone Git GUI based on EGit
Eclipse Public License 2.0
408 stars 38 forks source link

Impossible to access right-click menu that allows to add a repository, once one in the list is selected #23

Closed php4fan closed 2 years ago

php4fan commented 2 years ago

1) Look at this context menu that can be accessed by right-clicking in the empty part of the Repositories panel:

image

As far as I can find, this is the only way to get to the option "Add a Git repository".

2) Now, I select one of the repositories (in my case the only one) by clicking on it.

3) Now I try to access the abovementioned menu again by right-clicking on the same area as before:

image

As you can see, this opens the wrong context menu, as if I had right-clicked on the selected repository.

Now, I have no way at all (that I have been able to find) to access the original menu again. There is no way to unselect the repository that is selected: no matter where I try to click, it remains selected, and no matter where I try to right-click, the menu that comes out is the one that should only come out when right-clicking on the repository.

The only way I have found to be able to get to the "Add a new repository" option again, is to f*ing restart MeGit.**

php4fan commented 2 years ago

There is actually a workaround slightly less annoying than restarting MeGit entirely, which is to close and reopen the Repositories view. I close it with the "X" and then reopen it with Windows -> Show View -> Repositories.

planger commented 2 years ago

Thanks for the feedback! You can also use the toolbar which offers the same actions or deselect the repository (Ctrl-Click) first and then right-click: https://user-images.githubusercontent.com/588090/194721885-668653ce-47af-43de-82b7-77df6353c816.mp4

Also you can use Ctrl-3 and type "Add repo" and the action should show up.

As this is an SWT tree, I don't think we can easily modify its native default behavior (ie deselecting when clicking into the void).

php4fan commented 2 years ago

https://github.com/eclipse-platform/eclipse.platform.swt/issues/427#issuecomment-1272402781

This is default behavior on Linux GTK [...] It's easy enough to change this behavior in SWT applications by subscribing to SWT.MouseDown and using Tree.getItem(). When null, this means that empty space is clicked, and app can then deselect items.