Initialising new elements in a new GMF diagram
To initialise the initial contents of a newly created GMF diagram, simply modify the code in XXXDiagramEditorUtil.createInitialModel():
private static InternetApplication createInitialModel() {
// default code
InternetApplication app = ModelFactory.eINSTANCE.createInternetApplication();
// custom code starts here
Page page = VisualFactory.eINSTANCE.createPage();
page.setName("Home");
app.getChildren().add(page);
return app;
}
You don’t have to wrap this logic up within any TransactionalEditingDomains, so you can use EMF directly. This can also be implemented as a dynamic template.