开发者

Unbind F1 'Help' keyboard shortcut in eclipse

开发者 https://www.devze.com 2023-01-11 19:01 出处:网络
How can you unbind the F1 keyboard shortcut i开发者_开发问答n Eclipse?I have unbound it using the Windows -> Preferences -> General -> Keys, but it appears to have no effect (F1 still brings up the he

How can you unbind the F1 keyboard shortcut i开发者_开发问答n Eclipse? I have unbound it using the Windows -> Preferences -> General -> Keys, but it appears to have no effect (F1 still brings up the help pane, regardless of the binding in the Keys Preference).

Is F1/Help treated as a special case shortcut in Windows?


It doesn't matter that F1 generates a help event on Windows. As explained here, SWT generates both a help event and a key event when F1 is pressed. You can map things to F1 and it will work, but it will still also open help.

To fix this, delete the JAR file in the plugins directory that starts with "org.eclipse.help.base". Help will no longer open!

Edit: in fact, I use this to smoke Eclipse junk:

rm -rf readme
rm -rf *.html

rm -rf features/org.eclipse.aether*
rm -rf features/org.eclipse.cvs*
rm -rf features/org.eclipse.egit*
rm -rf features/org.eclipse.gef*
rm -rf features/org.eclipse.help.ui*
rm -rf features/org.eclipse.jgit*
rm -rf features/org.eclipse.m2e*
rm -rf features/org.eclipse.mylyn*
rm -rf features/org.eclipse.team.cvs*
rm -rf features/org.eclipse.wb*
rm -rf features/org.eclipse.wst*
rm -rf features/org.eclipse.xsd*
rm -rf features/org.eclipse.epp.mpc*
rm -rf features/org.eclipse.buildship*
rm -rf features/org.eclipse.oomph*
rm -rf features/org.eclipse.recommenders*

rm -rf plugins/org.eclipse.aether*
rm -rf plugins/org.eclipse.cvs*
rm -rf plugins/org.eclipse.egit*
rm -rf plugins/org.eclipse.gef*
rm -rf plugins/org.eclipse.help.ui*
rm -rf plugins/org.eclipse.jgit*
rm -rf plugins/org.eclipse.m2e*
rm -rf plugins/org.eclipse.mylyn*
rm -rf plugins/org.eclipse.team.cvs*
rm -rf plugins/org.eclipse.wb*
rm -rf plugins/org.eclipse.wst*
rm -rf plugins/org.eclipse.xsd*
rm -rf plugins/org.eclipse.epp.mpc*
rm -rf plugins/org.eclipse.buildship*
rm -rf plugins/org.eclipse.oomph*
rm -rf plugins/org.eclipse.recommenders*


If you installed eclipse in the default location, go to:

C:\Users\[your username]\.p2\pool\plugins

and search for:

org.eclipse.help.base

then, after closing eclipse, add .jbak to the end of the file you found. This should fix the problem. If for whatever reason you need it back, just remove the .jbak from the file name and restart eclipse.

Note: you will need to agree to windows warning and close eclipse before renaming the file.


According to this Microsoft KB the F1 is a system-wide shortcut, so you won't be able to remap it inside your application.


Edit: below commands ruin your code completion if you used the OOMPH installer. I didn’t restore all plugins one by one, restart Eclipse to see if it works again, but just restored all OOMPH and recommenders features and plugins. For that I downloaded the Eclipse archive (in my case JEE) and just copied the features and plugins from the extracted archive to my .p2\pool\feature respectively \plugins.

To modify @NateS’s answer for PowerShell so you can just copy it. If you installed Eclipse via installer go to your .p2 directory (most likely C:\Users\Name.p2\pool and run the commands from there.

Remove-Item -Force -Recurse features/org.eclipse.aether*
Remove-Item -Force -Recurse features/org.eclipse.gef*
Remove-Item -Force -Recurse features/org.eclipse.help.ui*
Remove-Item -Force -Recurse features/org.eclipse.jgit*
Remove-Item -Force -Recurse features/org.eclipse.m2e*
Remove-Item -Force -Recurse features/org.eclipse.mylyn*
Remove-Item -Force -Recurse features/org.eclipse.team.cvs*
Remove-Item -Force -Recurse features/org.eclipse.wb*
Remove-Item -Force -Recurse features/org.eclipse.wst*
Remove-Item -Force -Recurse features/org.eclipse.xsd*
Remove-Item -Force -Recurse features/org.eclipse.epp.mpc*
Remove-Item -Force -Recurse features/org.eclipse.buildship*
Remove-Item -Force -Recurse features/org.eclipse.oomph*
Remove-Item -Force -Recurse features/org.eclipse.recommenders*

Remove-Item -Force -Recurse plugins/org.eclipse.aether*
Remove-Item -Force -Recurse plugins/org.eclipse.gef*
Remove-Item -Force -Recurse plugins/org.eclipse.help.ui*
Remove-Item -Force -Recurse plugins/org.eclipse.jgit*
Remove-Item -Force -Recurse plugins/org.eclipse.m2e*
Remove-Item -Force -Recurse plugins/org.eclipse.mylyn*
Remove-Item -Force -Recurse plugins/org.eclipse.team.cvs*
Remove-Item -Force -Recurse plugins/org.eclipse.wb*
Remove-Item -Force -Recurse plugins/org.eclipse.wst*
Remove-Item -Force -Recurse plugins/org.eclipse.xsd*
Remove-Item -Force -Recurse plugins/org.eclipse.epp.mpc*
Remove-Item -Force -Recurse plugins/org.eclipse.buildship*
Remove-Item -Force -Recurse plugins/org.eclipse.oomph*
Remove-Item -Force -Recurse plugins/org.eclipse.recommenders*

I actually like JGit and use it so I removed that line for the feature/ and plugins/. You could also comment them out by adding a % in front of the line.

Go to the directory where your eclipse.exe is (either way you choose the path yourself when you extracted the archive or when you installed it. Mine is under C:\eclipse\jee-oxygen\eclipse) and run these two commands.

Remove-Item -Force -Recurse readme
Remove-Item -Force -Recurse *.html
0

精彩评论

暂无评论...
验证码 换一张
取 消