[472592][idea] Implement DocumentationProvider

Signed-off-by: Moritz Eysholdt <moritz.eysholdt@itemis.de>
This commit is contained in:
Moritz Eysholdt 2015-07-14 16:32:31 +02:00
parent 1ff3694546
commit bba77e5591

View file

@ -55,6 +55,7 @@ import org.eclipse.xtext.resource.DerivedStateAwareResource;
import org.eclipse.xtext.util.CancelIndicator;
import org.eclipse.xtext.util.Strings;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.MapMaker;
/**
@ -776,4 +777,31 @@ public class EcoreUtil2 extends EcoreUtil {
}
}).iterator();
}
/**
* Returns an Iterable that iterates over all containers of this EObject, from leaf to root. The <code>obj</code>
* itself is not included.
*
* @since 2.9
*/
public static Iterable<EObject> getAllContainers(final EObject obj) {
return new Iterable<EObject>() {
@Override
public Iterator<EObject> iterator() {
return new AbstractIterator<EObject>() {
private EObject current = obj;
@Override
protected EObject computeNext() {
current = current.eContainer();
if (current == null)
return endOfData();
return current;
}
};
}
};
}
}