Java Eclipse 组织导入快捷方式 (Ctrl+Shift+O) 不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45256038/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse Organize Imports Shortcut (Ctrl+Shift+O) is not working
提问by Jagadeesh
Eclipse used to import missing packages when I press Ctrl+Shift+O.
当我按Ctrl+ Shift+时,Eclipse 曾经导入丢失的包O。
The shortcut key has stopped working when used in Java files but the same shortcut is working in Python files (importing missing packages).
在 Java 文件中使用时,快捷键已停止工作,但在 Python 文件中使用相同的快捷键(导入丢失的包)。
Any thoughts on how to fix the issue.
关于如何解决问题的任何想法。
Below are couple of snapshots for your reference.
以下是几张快照供您参考。
采纳答案by codemonkey
To fix this issue:
要解决此问题:
Go to Preferences
-> General
-> Keys
Click on Filters...
and de-select Filter uncategorized commands
then Ok
.
转到Preferences
- > General
- >Keys
点击Filters...
和去选择Filter uncategorized commands
,然后Ok
。
Then look for the command Go To Symbol in File
and select it.
Then click on Unbind
and then Apply
and Close
然后查找命令Go To Symbol in File
并选择它。然后点击Unbind
然后Apply
关闭
Ctrl+Shift+O. should now work.
Ctrl+ Shift+O。现在应该可以工作了。
EDIT:
编辑:
Also unbind any other conflicting commands and leave only one command for Ctrl+Shift+Oand set the When
to Editing Java Source
.
也解除绑定任何其他冲突的命令,并只留下一个用于命令Ctrl+ Shift+O并设置When
到Editing Java Source
。
回答by howlger
The Java Organize Importcommand is overwritten by another Ctrl+Shift+Ocommand: in Window > Preferences: General > Keysthe Java Organize Importcommand (where Whenis In Windows) is bound to Ctrl+Shift+O, but in the main and right-click menu Source > Organize Importsthe command is displayed without the shortcut.
Java的组织导入命令被另一个覆盖Ctrl+ Shift+O的命令:在窗口>首选项:常规>键了Java组织导入命令(其中当是在Windows)势必Ctrl+ Shift+ O,但在主要和右键菜单源>组织导入命令显示时没有快捷方式。
There are two solutions for this problem:
这个问题有两种解决方案:
Change or remove the shortcut of the command that overwritesthe Java Organize Importcommand:
- Find the command: In the Java editor press Ctrl+Shift+Land see which command is bound to Ctrl+Shift+O. Probably, it is the Beans Quick Outlinecommand.
- In Window > Preferences: General > Keyschange or remove the binding for the found command.
Restricts the scope of the shortcutof Java Organize Importto the Java editor:
- In Window > Preferences: General > Keysselect the Java Organize Importcommand and change Whenfrom In Windowsto Editing Java Source. This solution restricts Ctrl+Shift+Oto the Java editor and disables the shortcut in the Package/Project Explorer.
更改或删除覆盖Java Organize Import命令的命令的快捷方式:
- 查找命令:在Java编辑器中按Ctrl+ Shift+ L,看看哪些命令势必Ctrl+ Shift+ O。可能是Beans Quick Outline命令。
- 在Window > Preferences: General > Keys 中更改或删除找到的命令的绑定。
将Java Organize Import的快捷方式的范围限制在Java 编辑器中:
- 在Window > Preferences: General > Keys 中选择 Java Organize Import命令并将When从In Windows更改为Editing Java Source。该解决方案限制+ +到Java编辑器,并禁止在快捷封装/项目资源管理器。CtrlShiftO
See also: Spring IDE issue #160: organize imports is not working
回答by razvan
Window -> Preferences -> General -> Keys
窗口 -> 首选项 -> 常规 -> 按键
Click on Binding to sort by Binding then scroll and find Ctrl+Shift+O
单击绑定以按绑定排序,然后滚动并找到Ctrl+ Shift+O
If several Organized imports are present edit one bind and choose WHEN: EDITING JAVA SOURCE.
如果存在多个有组织的导入,请编辑一个绑定并选择 WHEN: EDITING JAVA SOURCE。
Remove( UNBIND COMMAND) for other existing bindings.
删除(UNBIND COMMAND)用于其他现有绑定。
Restart Eclipse
重启 Eclipse
回答by andrbrue
Please keep in mind that if you are using an AMD GPU your Radeon Driver could block Ctrl+Shift+Owhich it uses to toggle an ingame-overlay. It can be changed to other keys as follows: Games
->global settings
->performance monitoring
请记住,如果您使用的是 AMD GPU,您的 Radeon 驱动程序可能会阻止Ctrl+ Shift+ O,它用于切换游戏内覆盖。可以按如下方式更改为其他键:Games
-> global settings
->performance monitoring
回答by nanosoft
Above shortcut resulted in GPU details being popped up on my screen. SO it was bound to some other app which was overriding it. What worked for me is -> check.
上面的快捷方式导致我的屏幕上弹出 GPU 详细信息。所以它绑定到其他一些覆盖它的应用程序。对我有用的是 -> check。
You need to go to Gaming > Global Settings > Performance Monitoring > Toggle Performance Logging Hotkey
您需要转到游戏 > 全局设置 > 性能监控 > 切换性能日志热键
You will see this is bound to Ctrl + Shift + O (so the shortcut is used - just buried).
您将看到这与 Ctrl + Shift + O 绑定(因此使用了快捷方式 - 只是被埋没了)。
To remove the shortcut (not an obvious process at all!) you need to click the Toggle Performance Logging Hotkey button, it will then ask to enter your hotkey, you then press delete - that is Del (not backspace, not esc or anything else - the Del key).
要删除快捷方式(根本不是一个明显的过程!),您需要单击“切换性能记录热键”按钮,然后它会要求输入您的热键,然后按删除 - 即 Del(不是退格键,不是 esc 或其他任何东西- Del 键)。