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 05:27 Go to next message
Marcin Dabrowski is currently offline Marcin Dabrowski
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 05: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 04:49 Go to previous messageGo to next message
Marcin Dabrowski is currently offline Marcin Dabrowski
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 05:51 Go to previous message
Thorsten Schlathölter is currently offline Thorsten Schlathölter
Messages: 208
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: Mon Jul 28 00:22:39 EDT 2014

Powered by FUDForum. Page generated in 0.02111 seconds