Steffi S. Steffi S. -4 years ago 185
Java Question

The Secret Of Restoring Views

After switching from Eclipse 3.7 to Eclipse 4.5 we stumbled over the bug that the application sometimes restores views (but as far as we can tell, never editors, even though that's now the same thing).

The most prominent example is the exit action (

), which makes the application started next restore views. The little X on the top right however does nothing of the sort. Killing the application process will store the views about half of the time.

We don't want any restoring (because our views usually show database objects, and these cannot be shown before a connection to the database is created).

The only method I found that sounds even similar to what I want is:

public class ApplicationWorkbenchAdvisor extends SpaceWorkbenchAdvisor {

public void initialize(IWorkbenchConfigurer configurer) {

...but as far as I can tell this does nothing at all (doesn't matter if true or false).

So how do I prevent Eclipse from trying to restore Views (and failing miserably)?

Answer Source

Specify false for the restorable option on the org.eclipse.ui.views declaration of the view in the plugin.xml.

You can stop any attempt to restore the persisted state with the -clearPersistedState option in the RCP .ini file. You can stop the persistence on exit with the -persistState false .ini option.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download