![](/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.