2013-04-05 56 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