Hi Smadar,
yes there is a Java API generated with the Eclipse Modeling Framework that you can use to create a statechart programmatically.
Add a dependency to org.yakindu.sct.model.sgraph in your plugin and you can create Models like this:
public class StatechartBuilder {
public static void main(String[] args) {
Statechart statechart = SGraphFactory.eINSTANCE.createStatechart();
Region main = SGraphFactory.eINSTANCE.createRegion();
statechart.getRegions().add(main);
Entry entry = SGraphFactory.eINSTANCE.createEntry();
entry.setKind(EntryKind.INITIAL);
State stateA = SGraphFactory.eINSTANCE.createState();
stateA.setName("A");
Transition transition1 = SGraphFactory.eINSTANCE.createTransition();
transition1.setSource(entry);
transition1.setTarget(stateA);
State stateB = SGraphFactory.eINSTANCE.createState();
stateB.setName("B");
Transition aToB = SGraphFactory.eINSTANCE.createTransition();
aToB.setSpecification("after 10 s");
aToB.setSource(stateA);
aToB.setTarget(stateB);
}
}
2: If a semantic change is detected, the simulator asks if you want to restart or terminate the simulation.
This could be improved in the way hot code replacement works in your IDE, but it is not implemented yet.
Best,
Andreas