Anyway, to my understanding, your case is not supported out of the box, so some manual tweaks are required.
I have just reproduces the similar situation with one of the small testing models.
Here I have a Diagram(=your Model) that has not-containment refs to Borders(=your Element's), and separate UltimateContainer which has the actual containments to Borders.
UltimateContainer itself is contained in the Diagram but the same trick will work with whatever logic for choosing actual container, provided you have a navigable path from Diagram to that appropriate container.
So I did the following. In the map model, node reference for Border (= Element),
- set "containment feature" to the actual containment (UltimateContainer#borders)
- set "children feature" the the non-containment reference from canvas to element (Diagram#borders)
- ignored the "Top Level Node Containment Feature must be available in the diagram..." warning for GmfGen model after transformation
- in the generated class LineBorderCreateCommand (something like ElementCreateCommand in your case, you will find it by compilation error ignored warning had warn you about) did the following manual change:
/**
* @generated NOT
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
LineBorder newElement = BordersFactory.eINSTANCE.createLineBorder();
//was generated: UltimateContainer owner = (UltimateContainer) getElementToEdit();
//<begin changes> *** replace with your knowledge about where to put newElement ***
Diagram diagram = (Diagram)getElementToEdit();
UltimateContainer owner = diagram.getContainer();
if (owner == null) {
owner = BordersFactory.eINSTANCE.createUltimateContainer();
diagram.setContainer(owner);
}
//<end of changes>
owner.getBorders().add(newElement);
Diagram childHolder = (Diagram) getElementToEdit();
childHolder.getBorders().add(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
If this does not work for you, please post to forum (you may also wish to notify me personally about your post to speed up the things).