Persisting Selection of CheckBoxTreeViewer between sessions [message #724862] |
Tue, 13 September 2011 07:25 |
Eclipse User |
|
|
|
I want to persist the check state of my CheckBoxTreeViewer elements. I have override the following method.
public void saveState(IMemento memento) {
super.saveState(memento);
ISelection sel = viewer.getSelection();
IStructuredSelection ss = (IStructuredSelection) sel;
StringBuffer buf = new StringBuffer();
for (Iterator it = ss.iterator(); it.hasNext() {
buf.append(it.next());
buf.append(',');
}
memento.putString(STORE_SELECTION, buf.toString());
}
The problem is the line marked in the bold is returning me EMPTY_SELECTION, even though I have some elements checked in my CheckBoxTreeViewer.
I have also override the init method as follows.
public void init(IViewSite site, IMemento memento)
throws PartInitException {
super.init(site, memento);
this.memento = memento;
}
Can anybody help me in resolving this issue? I am using Eclipse 3.2. Please let me know if I am doing anything wrong.
Let me know in case any more information is required.
Thanks!
Vasav
|
|
|
Powered by
FUDForum. Page generated in 0.27103 seconds