在eclipse中设置启动配置的属性
作为eclispe3.7中的一个应用程序,我想在每次启动时为启动配置设置一个属性。Iam使用以下命令设置属性,但在获取属性时,它仅显示默认属性值在eclipse中设置启动配置的属性,eclipse,configuration,attributes,launch,Eclipse,Configuration,Attributes,Launch,作为eclispe3.7中的一个应用程序,我想在每次启动时为启动配置设置一个属性。Iam使用以下命令设置属性,但在获取属性时,它仅显示默认属性值 launch.getLaunchConfiguration().getWorkingCopy().setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, value); 在另一个类上,使用以下代码从第一个类启动: launch.getLaunchConfiguration()..getWork
launch.getLaunchConfiguration().getWorkingCopy().setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, value);
在另一个类上,使用以下代码从第一个类启动:
launch.getLaunchConfiguration()..getWorkingCopy().getAttributes();
为什么不能设置属性?请帮助我…我怀疑问题在于每次调用getWorkingCopy()都会得到不同的工作副本。如果在调试器中检查工作副本对象的Java ID,则可以确定 希望这有帮助,
Thomas当您使用getWorkingCopy()时,您将获得原始状态的副本,但除此之外还需要使用doSave() 你可以在这里阅读,它是如何工作的:
ILaunchConfigurationWorkingCopy launchCopy = launch.getWorkingCopy();
launchCopy.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, value);
launch = launchCopy.doSave();