2013-04-05 58 views
0

eclispe3.7中的应用程序,我希望在每次启动时将属性设置为启动配置。 Iam使用以下命令设置属性,但在获取属性时,仅显示默认属性值。在eclipse中设置属性以启动配置

launch.getLaunchConfiguration().getWorkingCopy().setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, value); 

另一个类,从推出第一类是使用下面的代码获得:

launch.getLaunchConfiguration()..getWorkingCopy().getAttributes(); 

为什么属性不能设置?请帮助我...

回答

0

我怀疑问题在于每次调用getWorkingCopy()都会得到不同的工作副本。如果您在调试器中检查工作副本对象的Java ID,那么您将能够确定。

希望这有助于 托马斯

0

当您使用getWorkingCopy(),你得到的原始状态的副本,但你需要使用DoSave就会()之外。

ILaunchConfigurationWorkingCopy launchCopy = launch.getWorkingCopy(); 
launchCopy.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, value); 
launch = launchCopy.doSave(); 

您可以阅读,它是如何在这里工作:http://comments.gmane.org/gmane.comp.ide.eclipse.platform.debug.devel/240