sergey_208
sergey_208

Reputation: 657

Eclipse shortcut keys do not work properly in Windows 10

When I try to comment out multiple lines by CTRL+ Shift + /, it started working as Collapse All feature in Eclipse. I restored the defaults setting as recommended in other websites but did not help.

For instance, when I do CTRL+ Shift + L, I can see the Add Block Comment option and when I click it, it works. However, the shortcut shown as CTRL+ Shift + / is not working.

Here is my list of available key bindings using CTRL+ Shift + L:

available key bindings

How can I fix this problem?

Edit: Here is the screenshot of the list of the key bindings in Window > Preferences > Keys:

Second Edit: I use Windows 10 and I downloaded the last version of Eclipse which is 2019-09. I created a new project and a new Java class. The shortcut still works as collapse all.

I realized that CTRL+ Shift + Numpad_Divide is defined as collapse all. For some reason, my computer consider / as Numpad_Divide and does not function as comment out.

PreferencesBindings

Upvotes: 0

Views: 2267

Answers (2)

M1kyyy
M1kyyy

Reputation: 41

Just throwing this for future users:

I had the same issue on my eclipse. I am using windows 10 as well.

Anyway before the commands CTRL+SHIFT+numpad... will work first you need to "enable" this mode by pressing CTRL+numpad_divide. You will notice that next to all functions little minus signs will apear. Once you do that you will be able to use colapse, colapse all, expand, expand all.

Pressing CTRL+numpad_divide again will disable this mode and you won't be able to use those shortcuts.

Upvotes: 4

skomisa
skomisa

Reputation: 17343

Most keyboards have two "/" keys, and the problem you experienced will arise if the incorrect "/" key is used when trying to Add Block Comment for selected code:

  • The "/" key on the number pad is the divide key, and this is the key that must be used with CTRL + Shift + / to Collapse All.
  • The "/" key to the immediate left of the Shift key is the forward slash key, and this is the key that must be used with CTRL + Shift + / to Add Block Comment for selected code.

You can see the distinction when viewing the Tools > Preferences > General > Keys screen, though it is not obvious at all:

  • For Collapse All, Eclipse helpfully describes the divide key as "Numpad_Divide" for the binding:

    NumpadDivideSlash

  • However, for Add Block Comment Eclipse only describes the forward slash key as "/" for the binding:

    ForwardSlashKey

Eclipse could remove the ambiguity if it described the forward slash key as "Forward_Slash" instead of "/".

Upvotes: 2

Related Questions