Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Polarsys » Capella Studio » Restrict the number of instances of an extension element
Restrict the number of instances of an extension element [message #1829395] Thu, 02 July 2020 15:24 Go to next message
Soulimane KAMNI is currently offline Soulimane KAMNIFriend
Messages: 20
Registered: February 2020
Junior Member

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.

[Updated on: Thu, 02 July 2020 15:54]

Report message to a moderator

Re: Restrict the number of instances of an extension element [message #1829648 is a reply to message #1829395] Wed, 08 July 2020 09:08 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
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:

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:

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.
Previous Topic:How to display a node to extend a capella element?
Next Topic:create a matrix as a diagram like the for traceability or allocation
Goto Forum:

Current Time: Wed Jun 07 00:34:28 GMT 2023

Powered by FUDForum. Page generated in 0.02550 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top