我想實現一個eclipse插件來將shell腳本作爲外部工具生成器添加到項目中。按下插件菜單後,eclipse配置文件.project會添加如下。並且會生成另一個配置文件.externalToolBuilders/lstest [Builder] .launch。關於eclipse擴展工具生成器編程的問題
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value><project>/.externalToolBuilders/lstest [Builder].launch</value>
</dictionary>
</arguments>
</buildCommand>
目前,我可以使用下面的代碼添加到.project。但是我怎麼才能生成.externalToolBuilders/lstest [Builder] .launch?非常感謝你。
org.eclipse.core.resources.ICommand command = pDesc.newCommand();
command.setBuilderName("org.eclipse.ui.externaltools.ExternalToolBuilder");
Map args = command.getArguments();
args.put("LaunchConfigHandle", "<project>;/.externalToolBuilders/lstest [Builder].launch");
args = conf.getAttributes();
command.setArguments(args);
org.eclipse.core.resources.ICommand command = BuilderUtils.commandFromLaunchConfig(projects[i],conf);
org.eclipse.core.resources.ICommand[] commands = pDesc.getBuildSpec();
org.eclipse.core.resources.ICommand[] nc = new ICommand[commands.length + 1];
System.arraycopy(commands, 0, nc, 1, commands.length);
nc[0] = command;
pDesc.setBuildSpec(nc);
projects[i].setDescription(pDesc, null);
感謝您的反饋之前,添加以下行! – user2510797 2010-11-30 23:10:30