Examples of ODOMElement


Examples of com.volantis.mcs.eclipse.common.odom.ODOMElement

        // see if the element has a standard element. If no standard
        // element exists then we don't have anything to restore.
        Element standardElement = findStandardElement(element);
        if (standardElement != null) {
            synchronized (parent) {
                ODOMElement restoreElement = null;
                // remove the listeners
                parent.removeChangeListener(parentListener,
                        ChangeQualifier.HIERARCHY);
                element.removeChangeListener(elementListener);
                // find the index of the managed element in the parents content
                // list
                int elementIndex = parent.getContent().indexOf(element);

                // get the content of the standard element. If it has not content
                // then the element originally did not exist.
                List standardChildren = standardElement.getChildren();
                if (!standardChildren.isEmpty()) {
                    // need to check that there is only one child
                    if (standardChildren.size() > 1) {
                        throw new IllegalStateException(
                                "The standard element has more than one child");
                    }
                    // get the element that will be restored
                    restoreElement =
                            (ODOMElement) standardChildren.get(0);

                    // Move all listeners from the current element to the
                    // restored element.
                    element.moveListeners(restoreElement);

                    // we need to detach this from the standard element
                    restoreElement.detach();
                    // updated the parent so that the restored element is
                    // restored to the correct index
                    parent.getContent().add(elementIndex, restoreElement);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.