Package org.python.pydev.navigator.ui.PydevPackageExplorer

Examples of org.python.pydev.navigator.ui.PydevPackageExplorer.PydevCommonViewer


                    System.out.println("Memento == null:" + memento == null);
                }
                return;
            }

            PydevCommonViewer treeViewer = (PydevCommonViewer) viewer;

            //we have to restore it only at the 'right' time... see https://bugs.eclipse.org/bugs/show_bug.cgi?id=195184 for more details
            if (!treeViewer.availableToRestoreMemento) {
                if (DEBUG) {
                    System.out.println("Not available for restore");
                }
                return;
            }
            if (DEBUG) {
                System.out.println("Restoring");
            }

            IMemento[] expanded = memento.getChildren("expanded");
            IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
            for (IMemento m : expanded) {
                Object resource = getResourceFromPath(root, m);
                if (resource != null) {
                    if (DEBUG) {
                        System.out.println("Expanding:" + resource);
                    }
                    //it has to be done level by level because the children may be created
                    //for each expand (so, we 1st must expand the source folder in order to
                    //get the correct folders beneath it).
                    treeViewer.expandToLevel(resource, 1);
                }
            }

            ArrayList<TreePath> paths = new ArrayList<TreePath>();
            IMemento[] selected = memento.getChildren("selected");
            for (IMemento m : selected) {
                Object resource = getResourceFromPath(root, m);

                if (resource != null) {
                    treeViewer.expandToLevel(resource, 1);
                    if (DEBUG) {
                        System.out.println("Selecting:" + resource);
                    }
                    paths.add(new TreePath(getCompletPath(resource).toArray()));
                }
            }

            treeViewer.setSelection(new TreeSelection(paths.toArray(new TreePath[0])), true);
        } catch (Exception e) {
            Log.log(e);
        }
    }
View Full Code Here


            if (DEBUG) {
                System.out.println("saveState");
            }

            PydevCommonViewer treeViewer = (PydevCommonViewer) viewer;
            TreePath[] expandedTreePaths = treeViewer.getExpandedTreePaths();
            for (TreePath path : expandedTreePaths) {
                if (DEBUG) {
                    System.out.println("saveState expanded:" + path);
                }
                save(path, "expanded");
View Full Code Here

TOP

Related Classes of org.python.pydev.navigator.ui.PydevPackageExplorer.PydevCommonViewer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.