mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 08:48:55 +00:00
[472592][idea] Implement DocumentationProvider
Signed-off-by: Moritz Eysholdt <moritz.eysholdt@itemis.de>
This commit is contained in:
parent
1ff3694546
commit
bba77e5591
1 changed files with 28 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue