Question or issue on macOS:
I am switching back and forth between eclipse and intellij and am really missing the ability to “right click” using the keyboard when I am in eclipse. I am running OSX Leopard.
Does anyone know if this can be setup in the keys preferences, or is there a plugin that handles simulating a context menu at the current focused component?
How to solve this problem?
Solution no. 1:
As of Eclipse Juno, Shift+F10 works on Mac to bring up the context menu. It’s mapped in Preferences | Keys as Show Context Menu.
Solution no. 2:
Windows
For Windows, I don’t think you necessarily need an Eclipse-specific solution. Your keyboard might have a Context Menu key, or you can use Shift + F10 to bring up the context menu.
Source
OSX
After you updated your question to be specific to OSX, I did some searching, and it doesn’t seem like there’s a built-in OSX way to bring up a context menu. You might be able to find a program that will let you configure keystrokes to simulate mouse clicks, and then configure a shortcut to Ctrl + Click.
Eclipse Configuration
In Preferences -> General -> Keys
there are several “Menu” actions that are bindable. Perhaps you can use these? When I filter the options for “Menu”, I see, among others:
- Show Refactor Quick Menu (Alt + Shift + T)
- Show Source Quick Menu (Alt + Shift + S)
- etc.
Alternatively, you could just find those commands from the context menu that you use most frequently and bind some keyboard shortcuts to them in Preferences -> General -> Keys.
Solution no. 3:
On the old Apple branded external keyboards, the menu button is to the right of the space bar (Alt Gr, on PC style keyboards). Looking at the newer keyboards, and the Mac Book Pros, it doesn’t seem to be there (guess it went the same way as the Home, End, Page Up, Page Down and Delete keys).
Having a poke around the Preferences -> Keys preference page, I don’t think there is a way of revealing the entire context menu.
Many of the sub-menus are available from the keyboard – the ones I have committed to muscular memory are:
- Alt + ⌘ + T – refactoring menu, and the various refactorings available from the keyboard, using the modifiers Alt + ⌘
- Alt + ⌘ + S – Source menu, and various operations beginning with Shift + ⌘ – including organize imports, reformat.
- Shift + ⌘ + T – open type
- Shift + ⌘ + R – open resource
If all else fails, it is usually worth looking at Shift + ⌘ + L – which shows all current keyboard mappings in a hover on the side of the screen.
With these shortcuts, I would recommend learning one a day. Their culmulative effect is considerable.
I appreciate that this does not answer your question, but I hope it solves your problem.
Solution no. 4:
Click on the trackpad with two fingers, sort of like Moe poking Curly in the eyes.
Solution no. 5:
Does your keyboard have a menu key?
Solution no. 6:
While this unfortunately won’t provide a solution for your problem I think it’s still worth pointing out the following from The SWT FAQ (Eclipse facilitates SWT to implement its UI):
Q: What are the standard keyboard
shortcuts on Windows, Mac OS X, GTK?
A: Since SWT uses native controls, standard keyboard shortcuts can be
used in SWT applications. Here is a
useful Table of Keyboard Shortcuts.
Obviously your problem is manifesting itself in row ‘Pop up contextual menu for currently selected objects’ of this table, where all platforms but Mac OS do offer either shortcuts Shift + F10 or Menu or both.
While I can understand that SWT is using the native GUI libraries of the operating system and consequently does not offer this by default, I’m quite surprised that a huge and excellent developer tool like Eclipse is not providing a workaround here. How does IntelliJ solve this issue?
Solution no. 7:
Well, I know that Windows have a key right between the right Windows key and the right Ctrl key.
It is a context menu key. That may do what you want it to do.
Solution no. 8:
For MacOS try the following, it works like a charm for me
Ctrl + Click