eclipse / Xpect

This repository has been rewritten to move to the Eclipse Foundation. Find the old history here: https://github.com/TypeFox/Xpect
http://www.xpect-tests.org/
Eclipse Public License 2.0
32 stars 28 forks source link

EObjectAdapter should also find EObjects right under selection #196

Open meysholdt opened 8 years ago

meysholdt commented 8 years ago
        protected T find(Class<T> expectedType, INode node, Set<EObject> visited) {
            EObject current = node.getSemanticElement();
            int startoffset = node.getOffset();
            T result = null; // FIXME this should also find objects at current offset.
            while (current != null && NodeModelUtils.getNode(current).getOffset() >= startoffset) {
                if (expectedType.isInstance(current))
                    result = expectedType.cast(current);
                visited.add(current);
                current = current.eContainer();
            }
            return result;
        }