Package org.python.pydev.editor.codefolding

Examples of org.python.pydev.editor.codefolding.PyProjectionAnnotation


        try {
            if (model != null) {
                //put annotations in array list.
                Iterator iter = model.getAnnotationIterator();
                while (iter != null && iter.hasNext()) {
                    PyProjectionAnnotation element = (PyProjectionAnnotation) iter.next();
                    Position position = model.getPosition(element);

                    int line = ps.getDoc().getLineOfOffset(position.offset);

                    int start = ps.getStartLineIndex();
View Full Code Here


            if (iter != null) {
                //we just want to collapse the leafs, and we are working only with the not collapsed sorted by offset.

                List elements = new ArrayList(); //used to know the context
                while (iter.hasNext()) {
                    PyProjectionAnnotation element = (PyProjectionAnnotation) iter.next();

                    //special case, we have none in our context
                    if (elements.size() == 0) {
                        elements.add(element);

                    } else {
                        if (isInsideLast(element, elements, model)) {
                            elements.add(element);

                        } else {
                            //ok, the one in the top has to be collapsed ( and this one added )
                            PyProjectionAnnotation top = (PyProjectionAnnotation) elements.remove(elements.size() - 1);
                            model.collapse(top);
                            elements.add(element);
                        }
                    }
                }
                if (elements.size() > 0) {
                    PyProjectionAnnotation top = (PyProjectionAnnotation) elements.remove(elements.size() - 1);
                    model.collapse(top);
                }
            }
        }
    }
View Full Code Here

            if (iter != null) {
                //we just want to expand the roots, and we are working only with the collapsed sorted by offset.

                List elements = new ArrayList(); //used to know the context
                while (iter.hasNext()) {
                    PyProjectionAnnotation element = (PyProjectionAnnotation) iter.next();

                    //special case, we have none in our context
                    if (elements.size() == 0) {
                        model.expand(element);
                        elements.add(element);
View Full Code Here

        if (iter != null) {

            //get the not collapsed (expanded) and sort them
            ArrayList expanded = new ArrayList();
            while (iter.hasNext()) {
                PyProjectionAnnotation element = (PyProjectionAnnotation) iter.next();
                if (element.isCollapsed() == useExpanded) {
                    expanded.add(element);
                }
            }

            Collections.sort(expanded, new Comparator() {

                public int compare(Object o1, Object o2) {
                    PyProjectionAnnotation e1 = (PyProjectionAnnotation) o1;
                    PyProjectionAnnotation e2 = (PyProjectionAnnotation) o2;
                    int e1Off = model.getPosition(e1).getOffset();
                    int e2Off = model.getPosition(e2).getOffset();
                    if (e1Off < e2Off) {
                        return -1;
                    }
View Full Code Here

    protected boolean isInsideLast(PyProjectionAnnotation element, List elements, ProjectionAnnotationModel model) {
        if (elements.size() == 0) {
            return false;
        }

        PyProjectionAnnotation top = (PyProjectionAnnotation) elements.get(elements.size() - 1);
        Position p1 = model.getPosition(element);
        Position pTop = model.getPosition(top);

        int p1Offset = p1.getOffset();
View Full Code Here

TOP

Related Classes of org.python.pydev.editor.codefolding.PyProjectionAnnotation

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.