![](/img/trans.png)
[英]How to implement IWindowCloseHandler in Eclipse (e4) RCP?
[英]How to Remember the State in Eclipse e4
在Eclipse 3.x中,通过检查ApplicationWorkbenchAdvisor类中的restoreState()
方法,我们可以很容易地知道应用程序是第一次启动还是正在恢复状态,但是Eclipse 4.x中不提供此功能,所以任何人都可以帮助我我知道Eclipse 4中的Eclipse状态是否已恢复?
您可以在应用程序的“持久状态”中设置一个值,并在启动过程中进行检查。
最早的应用程序对象是LifeCyle
类的@ProcessAdditions
步骤。
@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
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.