Restrict the number of instances of an extension element

Hey,
I have created an extension element to be added to logical functions as child.
I create the element from the project explorer by adding the element to the logical function.
I am able to create as many as want of the extension elements.
My question is, how can I force capella to allow the user to create
one and only one child element.

I don’t know if it’s possible declaratively. But you can prevent appearance of the element creation action with the capella MDEMenuItemContribution extension point. For example here’s what capella does to prevent addition of LogicalFunction elements in illegal places:
https://github.com/eclipse/capella/blob/feb0b32d0d63bbe304591c67bbe0fb3c2f73a3f7/core/plugins/org.polarsys.capella.core.data.menu.contributions/src/org/polarsys/capella/core/data/menu/contributions/la/LogicalFunctionItemContribution.java#L48
So you just would implement that interface, and in your selectionContribution method just check if the extension element already exists and return false in that case. Then hook up the extension like this:
https://github.com/eclipse/capella/blob/feb0b32d0d63bbe304591c67bbe0fb3c2f73a3f7/core/plugins/org.polarsys.capella.core.data.menu.contributions/plugin.xml#L313
Note that this only prevents creation of the element from the UI. From a semantic point, it would still be perfectly legal to have more than one extension element in the model, e.g. I’m not sure how you would handle “Copy/Paste” of your extension element into the same parent, etc.