Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Restore expanded tree items in CommonNavigator
Restore expanded tree items in CommonNavigator [message #821380] Thu, 15 March 2012 09:27 Go to next message
Marcin Dabrowski is currently offline Marcin DabrowskiFriend
Messages: 2
Registered: March 2012
Junior Member
Hi,

Currently I'm trying to save and restore state of tree items in CommonNavigator. I used to use ResourceNavigator and NavigatorActionGroup to get this feature but I've found out that RN is deprecated at this moment. Unfortunately I can't find any tutorial or other information about this subject. Can anybody help with this?

Regards,

[Updated on: Thu, 15 March 2012 09:28]

Report message to a moderator

Re: Restore expanded tree items in CommonNavigator [message #822173 is a reply to message #821380] Fri, 16 March 2012 08:49 Go to previous messageGo to next message
Marcin Dabrowski is currently offline Marcin DabrowskiFriend
Messages: 2
Registered: March 2012
Junior Member
Ok, So maybe I'll ask in different way. What I currently have?

In my navigator class I've overrided method saveState()

   @Override
    public void saveState(IMemento aMemento) {

        final Object[] expanded = getCommonViewer().getVisibleExpandedElements();

        aMemento = aMemento.createChild("expanded");

        for (int i = 0; i < expanded.length; i++) {
            aMemento.createChild("nodes", expanded[i].toString());
        }

        super.saveState(aMemento);
    }


So as you can see I'm making a new child in memento containing array of strings (expanded elements).

Unfortunately this doesn't work as it should. During debbuging I've discovered that restore is not working properly. I think that there is problem with method internalSetExpanded in AbstractTreeViewer. Maybe my saved array is not correct? How to make a right child in memento. Unfortunately I couldn't find tutorial or any help in google. Anybody?

Regards,


Re: Restore expanded tree items in CommonNavigator [message #822206 is a reply to message #822173] Fri, 16 March 2012 09:51 Go to previous message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 312
Registered: February 2012
Location: Düsseldorf
Senior Member
Marcin,
I am not using CommonNavigator but I expect it to work similar to a TreeViewer. Therefore what comes into my mind when I look at your code is: are you sure that your restore process creates the correct objects that the viewer will be able to identify in the new model?
Previous Topic:Nullpointerexception (opening editor)
Next Topic:How to create an auto-extendable RCP product?
Goto Forum:
  


Current Time: Fri Apr 26 08:53:11 GMT 2024

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

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

Back to the top