简体   繁体   English

如何获取“查找下一个”以在Eclipse中的非标准扩展上工作?

[英]How to get Find Next to work on non-standard extensions in Eclipse?

I have to edit some files in Eclipse with extensions like .page and .component. 我必须在Eclipse中编辑一些扩展名为.page和.component的文件。 Everything seems to work ok in the editor, expect Find Next does not respond to F3. 一切似乎在编辑器中都可以正常运行,希望“查找下一个”不响应F3。 In fact, the menu doesn't even list the shortcut whenI am editing a .page or .component file (screenshot below). 实际上,当我编辑.page或.component文件时,菜单甚至没有列出快捷方式(下面的屏幕截图)。

So how do I make Eclipse do Find Next on F3 for these extensions? 那么,如何使Eclipse在F3上针对这些扩展执行Find Next?

在此处输入图片说明

From the Eclipse FAQ : Eclipse FAQ中

To see the current key configuration and its keyboard shortcuts, choose the Window > Preferences menu command to open the Eclipse workbench Preferences. 要查看当前的键配置及其键盘快捷键,请选择“ Window > Preferences菜单命令以打开Eclipse工作台首选项。 Select the General > Editor > Keys page. 选择“ General > Editor > Keys页面。 This page displays the currently active Scheme (key configuration) and the keyboard shortcuts it defines. 此页面显示当前活动的Scheme(键配置)及其定义的键盘快捷键。 Emacs is a set of keyboard shortcuts that emulates emacs. Emacs是一组模拟emacs的键盘快捷键。 Similarly, Microsoft Visual Studio defines a set of shortcuts that emulates that IDE. 同样,Microsoft Visual Studio定义了一组模拟该IDE的快捷方式。 The native configuration for Eclipse is Default. Eclipse的本机配置为Default。

There are no APIs for defining key-binding configurations programmatically, but you can create them in a plug-in by using the org.eclipse.ui.commands extension point. 没有用于以编程方式定义键绑定配置的API,但是您可以使用org.eclipse.ui.commands扩展点在插件中创建它们。 First, you need to define your new configuration: 首先,您需要定义新的配置:

 <keyConfiguration name="My Configuration" parent="org.eclipse.ui.defaultAcceleratorConfiguration" description="This is a simple configuration" id="org.eclipse.faq.sampleConfiguration"> </keyConfiguration> 

By specifying a parent, you are saying that your configuration should inherit key bindings from the parent unless they are explicitly set in your configuration. 通过指定父代,是说您的配置应继承父代的键绑定,除非在您的配置中显式设置了键绑定。 When key bindings are defined, they will refer to the configuration they belong to. 定义键绑定后,它们将引用它们所属的配置。 If you write your own configuration, you'll also need to define new key bindings for all the commands that you want to belong to your configuration. 如果您编写自己的配置,则还需要为要属于该配置的所有命令定义新的键绑定。

See also How do I provide a keyboard shortcut for my action? 另请参阅如何为操作提供键盘快捷键?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM