add a new file in the sandbox in language generation aspect

Hello foroum!
I tried to add a new file to my sandbox when clicking on build sandbox model.

following code
model.add root(mynode)
prettyPrint();

Unfortunately, no new file appears in the sandbox.

Can someone pls point me into the right direction

Regards,
msch95
4 comments
Here's what I've tried

ModelAccess.instance().runWriteActionInCommand(new Runnable() { 
  public void run() { 
    node<Inputs> inputs = new node<Inputs>(); 
    inputs.name = "Hello World"; 
    SNode result = (SNode) NodeFactoryManager.createNode(concept/Inputs/, null, null, this.rootNode.model); 
    this.rootNode.model.new root node(Inputs); 
    this.rootNode.model.add root(result); 
  } 
});
prettyPrint();
Unfortunately, none of them works. I followed that:
https://confluence.jetbrains.com/display/MPSD32/Open+API+-+accessing+models+from+code
and that
http://www.programcreek.com/java-api-examples/index.php?api=jetbrains.mps.smodel.action.NodeFactoryManager
0
Where are you calling the code from? What is the model?
0
I have a separate model called 'plugin', where the IDEA plugin button is stored.
Then in another model called 'sandbox' the user clicks this button and then it imports data from xml and create new root concepts of "Inputs" (filled with the xml data) in separate files in the 'sandbox' model.
0
thanks to @Daniel Ratiu
Solved it using
add to mbeddrPlatforumModelGroup at position <default>
in my action group and adding following code in my write action

write action { 
  this.mod.add root(new node<Inputs>()); 
}
prettyPrint();
0

Please sign in to leave a comment.