我研究插件已经有一段时间,最近在研究eclipse launch的获取。因为我本地开发的时候,经常要修改jboss的启动配置,加上-b 0.0.0.0,这样能支持本地ip的访问。
比较麻烦的是,有时候会忘记,然后用ip+端口一直无法访问,查半天。
给插件加上这个功能。后面可以自动去增加。
具体路径:workspace\.metadata\.plugins\org.eclipse.debug.core\.launches\Red Hat JBoss EAP 4.3.launch
参考代码:
ILaunchConfiguration[] configs=DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations();
if(configs==null || configs.length==0){
//提示("未找到对应Debug文件,请双击ServerView中的Server,并且点击open launch config 创建一个。");
return;
}
for (ILaunchConfiguration iLaunchConfiguration : configs) {
attributes=iLaunchConfiguration.getAttribute("org.eclipse.jdt.launching.PROGRAM_ARGUMENTS", "");
if(attributes.indexOf("-b 0.0.0.0")==-1){
ILaunchConfigurationWorkingCopy workCopy=iLaunchConfiguration.getWorkingCopy();
workCopy.setAttribute("org.eclipse.jdt.launching.PROGRAM_ARGUMENTS", attributes+" -b 0.0.0.0 ");
workCopy.doSave();
}
}
就这么简单啦

