source: default/trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/utils/URIFragmentResolver.java

Last change on this file was 54, checked in by zeiss, 14 years ago
  • Property svn:mime-type set to text/plain
File size: 798 bytes
Line 
1package de.ugoe.cs.swe.bnftools.utils;
2
3import org.eclipse.emf.ecore.EObject;
4import org.eclipse.xtext.parsetree.CompositeNode;
5import org.eclipse.xtext.parsetree.NodeAdapter;
6import org.eclipse.xtext.parsetree.NodeUtil;
7import org.eclipse.xtext.resource.XtextResource;
8import org.eclipse.xtext.util.concurrent.IUnitOfWork;
9
10public class URIFragmentResolver implements
11                IUnitOfWork<CompositeNode, XtextResource> {
12        private String uriFragment;
13
14        public URIFragmentResolver(String uriFragment) {
15                this.uriFragment = uriFragment;
16        }
17
18        public CompositeNode exec(XtextResource state) throws Exception {
19                EObject o = state.getEObject(uriFragment);
20               
21                if (o == null)
22                        return null;
23               
24                NodeAdapter node = NodeUtil.getNodeAdapter(o);
25
26                return node.getParserNode();
27
28        }
29}
Note: See TracBrowser for help on using the repository browser.