Reputation: 514
I have an eclipse plugin project that is basically a GUI to visualize data from external source.
I want to give the user the option to save the current configurations of the plugin project, i.e. which views are opened, current data being analysed and the values placed as input in the different views (JTextboxes etc.).
Thus the user may load the file to the restart the project from the last configuration.
Does such a save mechanism of the plugin project exist? Specially loading the project with previous views from the load file.
Upvotes: 0
Views: 300
Reputation: 111218
Views implement IPersistable
so you can implement the saveState
method:
@Override
public void saveState(IMemento memento)
{
memento.putString("key", "value");
....
}
override the ViewPart
init
method to restore the data saved in the memento:
@Override
public void init(IViewSite site, IMemento memento)
{
super.init(site, memento);
String value = memento.getString("key");
...
}
I am assuming you are doing a 3.x style RCP (using ViewPart
), for an e4 RCP different code is required.
Upvotes: 0