Search in sources :

Example 1 with ICommentAssociater

use of org.eclipse.xtext.parsetree.reconstr.ICommentAssociater in project xtext-core by eclipse.

the class CommentAssociationTest method createModel2CommentMap.

protected Multimap<EObject, String> createModel2CommentMap(Model model) {
    ICompositeNode rootNode = NodeModelUtils.getNode(model).getRootNode();
    ICommentAssociater commentAssociater = getInjector().getInstance(ICommentAssociater.class);
    Map<ILeafNode, EObject> map = commentAssociater.associateCommentsWithSemanticEObjects(model, Collections.singleton(rootNode));
    Multimap<EObject, String> multimap = ArrayListMultimap.create();
    for (Map.Entry<ILeafNode, EObject> entry : map.entrySet()) {
        multimap.put(entry.getValue(), entry.getKey().getText());
    }
    return multimap;
}
Also used : ILeafNode(org.eclipse.xtext.nodemodel.ILeafNode) EObject(org.eclipse.emf.ecore.EObject) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) Map(java.util.Map) ICommentAssociater(org.eclipse.xtext.parsetree.reconstr.ICommentAssociater)

Aggregations

Map (java.util.Map)1 EObject (org.eclipse.emf.ecore.EObject)1 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)1 ILeafNode (org.eclipse.xtext.nodemodel.ILeafNode)1 ICommentAssociater (org.eclipse.xtext.parsetree.reconstr.ICommentAssociater)1