eclipse:将键盘快捷键放在特定的启动配置上 [英] eclipse: put keyboard shortcuts on specific launch configurations

查看:122
本文介绍了eclipse:将键盘快捷键放在特定的启动配置上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

如何将特定密钥绑定到Eclipse中的不同启动配置?

我从eclipse中的绿色运行按钮旁边的小下拉菜单中多次启动某些程序。

I am launching certain programs many times from the little dropdown menu next to the green run-button in eclipse.

有没有办法将键(如F1 - F12)绑定到这些运行配置?

Is there a way to bind keys (like F1 - F12) to those run configurations?

我不能在首选项中找到类似的东西钥匙。

I couldnt find something like this in the preferences under "Keys".

推荐答案

目前没有办法绑定到特定的启动配置(没有自己编写插件代码)。以下是启动配置寻找一个命名的示例:

Currently there's no way to bind to a specific launch config (without writing the plugin code yourself). Here's an example of walking the launch configs looking for a named one:

public class LaunchRunAwayHandler extends AbstractHandler {
    @Override
    public Object execute(ExecutionEvent event) throws ExecutionException {
        try {
            final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
            ILaunchConfiguration toLaunch = null;
            for (ILaunchConfiguration config :launchManager.getLaunchConfigurations()) {
                System.out.println(config.getName());
                if (config.getName().equals("RunAway")) {
                    toLaunch = config;
                }
            }
            DebugUITools.launch(toLaunch, ILaunchManager.RUN_MODE);
        } catch (CoreException e) {
            throw new ExecutionException("Failed to launch", e);
        }
        return null;
    }

}

理论上你会写一个该命令提供了一个参数来选择名称,并定义了一个 org.eclipse.core.commands.IParameterValues ,以便您可以在Keys首选项页面中看到所有启动配置

In theory, you would write a command that provides takes a parameter to pick the name, and defines an org.eclipse.core.commands.IParameterValues so you could see all of your launch configs in the Keys preference page.

F11 上次启动调试 CTRL + F11 运行上次启动。您可能必须在首选项>运行/调试>启动中将首选项设置为始终启动先前启动的应用程序。但是这只会启动最后一个,而不是在启动之间切换。

F11 is Debug Last Launched and CTRL+F11 is Run Last Launched. You might have to set a preference in Preferences>Run/Debug>Launching to "Always launch the previously launched application". But that will just launch the last one, not switch between launches.

这篇关于eclipse:将键盘快捷键放在特定的启动配置上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆