I have an Eclipse plugin that uses a view that extends ViewPart . ViewPart has a saveState method that requires IMemento .
I added saveState code and the corresponding init method, and it works. Unfortunately, saveState is only called when the entire workspace is closed. My view is not so important that I can expect it to be open all the time. Therefore, it would be great if saveState is called when the view is closed.
I found that the listener of the part of the view makes sense to respond to closing the view, but I do not get where IMemento comes IMemento . Where can I get the memmento object that is used when closing the workspace? Or where do I need to save my own memory object so that part of the view uses it in the init method if the view is open (re)?
@Override public void saveState(IMemento memento) { super.saveState(memento); memento = memento.createChild(MEMENTO_GUI_STATE); memento.putBoolean(MEMENTO_IS_FLAT, !isHierarchicalModeActive()); memento.putBoolean(MEMENTO_IS_CATEGORY_MODE_ACTIVE, comboViewer.isVisible()); }
This is my saveState - can I say that my look somehow says to call it every time the view opens?
source share