|
Last change
on this file was
54,
checked in by zeiss, 15 years ago
|
|
|
-
Property svn:mime-type set to
text/plain
|
|
File size:
798 bytes
|
| Line | |
|---|
| 1 | package de.ugoe.cs.swe.bnftools.utils;
|
|---|
| 2 |
|
|---|
| 3 | import org.eclipse.emf.ecore.EObject;
|
|---|
| 4 | import org.eclipse.xtext.parsetree.CompositeNode;
|
|---|
| 5 | import org.eclipse.xtext.parsetree.NodeAdapter;
|
|---|
| 6 | import org.eclipse.xtext.parsetree.NodeUtil;
|
|---|
| 7 | import org.eclipse.xtext.resource.XtextResource;
|
|---|
| 8 | import org.eclipse.xtext.util.concurrent.IUnitOfWork;
|
|---|
| 9 |
|
|---|
| 10 | public 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.