在Eclipse 3.x中,通过检查ApplicationWorkbenchAdvisor类中的restoreState()
方法,我们可以很容易地知道应用程序是第一次启动还是正在恢复状态,但是Eclipse 4.x中不提供此功能,所以任何人都可以帮助我我知道Eclipse 4中的Eclipse状态是否已恢复?
You could set a value in the 'persisted state' of the application and check that during start up.
The earliest the application object is available is the @ProcessAdditions
step of the LifeCyle
class.
@ProcessAdditions
void processAdditions(MApplication app)
{
String value = app.getPersistedState().get("myKey");
if (value == null) // Starting with nothing to restore
{
app.getPersistedState().put("myKey", "set");
...
}
else
{
... persisted state exists
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.