Reputation: 329
In Eclipse 3.x we can easily know whether application is launching first time or it is restoring the state by checking method restoreState()
in ApplicationWorkbenchAdvisor class, but this feature is not available in Eclipse 4.x, So can anyone help me how can I know whether the Eclipse state is restore or not in Eclipse 4?
Upvotes: 0
Views: 218
Reputation: 111142
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
}
}
Upvotes: 1