不确定它是Eclipse还是Eclipse-plugin-dev回答。
在open-source Nodeclipse项目plugin.xml defines that .coffee file can be launched 中coffee
,coffee --compile
或Node with monitor
(有3 defined LaunchShortcuts)。
第一次它工作正常,但随后启动只重复以前的LaunchType。我发现删除已保存的LaunchConfiguration(从运行 - >运行配置)将再次运行(然后再次只作为此类型)
有问题的代码是LaunchShortcut(请参阅下面的代码段),但是没有任何if
检查,因此Eclipse org.eclipse.debug模块中的这种行为应该更深。
如何保存LaunchConfiguration会覆盖LaunchType?
/**
* Launch an file,using the file information, which means using default
* launch configurations.
*
* @param file
* @param mode
*/
private void launchFile(IFile file, String mode) throws CoreException {
// check for an existing launch config for the file
String path = file.getFullPath().toString();
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(Constants.LAUNCH_CONFIGURATION_TYPE_ID);
ILaunchConfiguration configuration = createLaunchConfiguration(type, path, file);
DebugUITools.launch(configuration, mode);
// then execution goes in LaunchConfigurationDelegate.java launch() method
}
/**
* Create a new configuration and set useful data.
*
* @param type
* @param path
* @param file
* @return
* @throws CoreException
*/
private ILaunchConfiguration createLaunchConfiguration(ILaunchConfigurationType type, String path, IFile file) throws CoreException {
String configname = file.getFullPath().toString().replace('/', '-');
if(configname.startsWith("-")) {
configname = configname.substring(1);
}
ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(type);
for(ILaunchConfiguration config : configs) {
if(configname.equals(config.getName())) {
return config;
}
}
// create a new configuration for the file
ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, configname);
workingCopy.setAttribute(Constants.KEY_FILE_PATH, path);
setMoreAttributes(workingCopy);
return workingCopy.doSave();
}
protected void setMoreAttributes(ILaunchConfigurationWorkingCopy workingCopy) {
// stub for extension
}
帮助!代码片段可能不足以回答问题,但引用文件和一切都在Github存储库中。提出了这个问题,因为我不确定是否可以为同一个文件提供多个运行配置。然后代码片段根本不重要。
更新:在plugin.xml defines that .coffee file can be launched 看了一会儿,我注意到我实际上在所有5个案例中都使用了相同的<configurationType
id= "org.nodeclipse.debug.launch.LaunchConfigurationType" >
。但是,为每次启动添加唯一的LaunchConfigurationType ID都没有区别。
答案 0 :(得分:0)
所以,我不知道我是否得到了你的所有问题,但让我看看我是否可以帮助你:
基本上,您可以使用以下方法创建启动配置:
Creating a Java application launch configuration
启动组也可以通过以下帮助进行设置:
直到这里我很确定你知道,所以让我们继续前进;您可以为同一个文件启用不同的启动配置,这是使用启动组工具处理的,如果您希望在同一环境中使用不同的配置,我不会得到的。
此处Launch Configuration Types和此处Adding launchers to the platform您可以找到有关启动类型文件结构的信息
此处完成Interface ILaunchConfigurationTabGroup是启动类型标签组的界面;
我在代码行中的建议:
<extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
<"launchConfigurationType1"
<"/launchConfigurationType1">
<"launchConfigurationType2"
<"/launchConfigurationType2">
//and so on...
</launchConfigurationTabGroup>
</extension>
我希望这可以帮助你,或者至少可以帮助你解决问题;)
欢呼声