Eclipse Organize Imports Shortcut (Ctrl+Shift+O) is not working

大城市里の小女人 提交于 2019-12-17 18:25:32

问题


Eclipse used to import missing packages when I press Ctrl+Shift+O.

The shortcut key has stopped working when used in Java files but the same shortcut is working in Python files (importing missing packages).

Any thoughts on how to fix the issue.

Below are couple of snapshots for your reference.


回答1:


To fix this issue:

Go to Preferences -> General -> Keys Click on Filters... and de-select Filter uncategorized commands then Ok.

Then look for the command Go To Symbol in File and select it. Then click on Unbind and then Apply and Close

Ctrl+Shift+O. should now work.

EDIT:

Also unbind any other conflicting commands and leave only one command for Ctrl+Shift+O and set the When to Editing Java Source.




回答2:


The Java Organize Import command is overwritten by another Ctrl+Shift+O command: in Window > Preferences: General > Keys the Java Organize Import command (where When is In Windows) is bound to Ctrl+Shift+O, but in the main and right-click menu Source > Organize Imports the command is displayed without the shortcut.

There are two solutions for this problem:

  • Change or remove the shortcut of the command that overwrites the Java Organize Import command:

    1. Find the command: In the Java editor press Ctrl+Shift+L and see which command is bound to Ctrl+Shift+O. Probably, it is the Beans Quick Outline command.
    2. In Window > Preferences: General > Keys change or remove the binding for the found command.
  • Restricts the scope of the shortcut of Java Organize Import to the Java editor:

    1. In Window > Preferences: General > Keys select the Java Organize Import command and change When from In Windows to Editing Java Source. This solution restricts Ctrl+Shift+O to the Java editor and disables the shortcut in the Package/Project Explorer.

See also: Spring IDE issue #160: organize imports is not working




回答3:


Please keep in mind that if you are using an AMD GPU your Radeon Driver could block Ctrl+Shift+O which it uses to toggle an ingame-overlay. It can be changed to other keys as follows: Games->global settings->performance monitoring




回答4:


Window -> Preferences -> General -> Keys

Click on Binding to sort by Binding then scroll and find Ctrl+Shift+O

If several Organized imports are present edit one bind and choose WHEN: EDITING JAVA SOURCE.

Remove( UNBIND COMMAND) for other existing bindings.

Restart Eclipse



来源:https://stackoverflow.com/questions/45256038/eclipse-organize-imports-shortcut-ctrlshifto-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!