Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. Features:
  2. 'feature' name = ID
  3. '{'(
  4. ('action' '{' action+=Actions (',' action+=Actions)* '}')? &
  5. ('dependencies' '{' dependencies = Dependencies '}')? &
  6. ('children' '{' children = Children '}')?
  7. )'}'
  8.  
  9. final XtextEditor editor = (XtextEditor)sourcepart;
  10. final IXtextDocument document = editor.getDocument();
  11. document.modify(new IUnitOfWork.Void<XtextResource>(){
  12. public void process (XtextResource resource) throws Exception {
  13. IParseResult parseResult = resource.getParseResult();
  14. if(parseResult ==null)
  15. return;
  16. CompositeNode rootNode=(CompositeNode) parseResult.getRootNode();
  17. LeafNode node = (LeafNode)NodeModelUtils.findLeafNodeAtOffset(rootNode, 0);
  18. EObject object =NodeModelUtils.findActualSemanticObjectFor(node);
  19.  
  20. action {
  21. act1.set (foo),
  22. act2.set (bar),
  23. act3.set (baz),
  24. act4.set (booze) //where this is the new action that I add
  25. }
  26.  
  27. action {
  28. act1.set (foo),
  29. act2.set (bar),
  30. act3.set (baz)
  31. }
  32.  
  33. action {
  34. act4.set(booze)
  35. }
  36.  
  37. Features:
  38. 'feature' name = ID
  39. '{'(
  40. ('action' '{' actionList=ActionList '}')? &
  41. ('dependencies' '{' dependencies = Dependencies '}')? &
  42. ('children' '{' children = Children '}')?
  43. )'}';
  44.  
  45. ActionList:
  46. (action+=Action (',' action+=Action)*)
  47. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement