Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Persist selection on tree viewer on restart of application using memento( Persist selection on tree viewer on restart of application using memento )
Persist selection on tree viewer on restart of application using memento [message #1275666] Sun, 23 March 2014 12:08 Go to next message
manu m is currently offline manu mFriend
Messages: 19
Registered: February 2014
Junior Member
am using memento for persisting views.
I am not able to persist selection on tree viewer I have the following code in save state


IStructuredSelection selection = (IStructuredSelection) viewer.getSelection()
Then I am storing this as selection.toString in memento



While restoring
IMemento storedSelection = memento.getChild("StoredSelection");
viewer.setSelection(new structured selection (selection) );

When setting selection on tree viewer I am getting proper value
but in selection change event it is telling empty selection due to which no selection is retained on tree


I am right now trying for single selection of tree
I would like to do tdo for multiple selections also

Please provide working sample code
Re: Persist selection on tree viewer on restart of application using memento [message #1313377 is a reply to message #1275666] Thu, 24 April 2014 21:29 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 493
Registered: July 2009
Senior Member

You have to also save and restore the collapsed state of your tree. Furthermore, the saved selection is no longer the object that is in the new tree.
Previous Topic:Add button to Console toolbar
Next Topic:e4 Luna and 3.x RCP Migrations
Goto Forum:
  


Current Time: Thu Apr 25 05:30:43 GMT 2024

Powered by FUDForum. Page generated in 0.02441 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top