Hi,
This is a long thread starter, and I'll agree to split this up to separate threads, if there's any interest.
I am still working on my UML-Profile for the Google Protobuf Message Definition Language. It quickly evolved from a simple UML-Profile to a
complete MDG-Technology Definition including a C# EA-AddIn to react to some certain events (praise Sparxians for their wisdom, that not all
of a group need to be implemented to catch just a single one!).
I was advised to use the PreNew events to react on and deny adding of unwanted Operations. I found out, how to use PostNew events, to adjust my stereotyped Element and Attribute settings. But when I'm adding tagged values (AttributeTags) through the Attribute.TaggedValues collection programmatically, they behave different vs. the tagged value definitions that come along with my stereotype from the UML-Profile.
I have defined (the same) tagged value(type?)s as
- public attributes in my profile stereotype definition
- custom tagged value types in the 'Settings->UML' dialog
For the latter I am using exactly the same naming as the tagged values from the UML-Profile stereotypes appear in the 'Tagged Values' window when the 'Show fully qualified Tags' option is set (e.g. Protobuf::protobuf::Field::Rule, the UML-Profile package is named 'Protobuf', the stereotype name is 'protobuf::Field' and the stereotype attribute is named 'Rule'). That's also the value I use for the Name and Type parameters of the Attribute.TaggedValues.AddNew() method, when creating a tagged value programmatically. The tagged values created with any of these methods (adding a stereotyped element from Profile Ressource or Toolbox, adding a tagged value explicitely from 'Tagged Values' window or added programmatically) can be retrieved using just the last name part as Name parameter of the TaggedValues.GetByName() method, and that's fine for my purposes so far.
But anyway in the 'Tagged Values' window they all behave differently:
- From UML-Profile: everything's fine and as expected; combobox is presented for enumerated values, namespace ('Protobuf::protobuf::<stereotype>') disappears when 'Show fully qualified Tags' is disabled
- From 'Add New' in 'Tagged Values' window: combobox is presented for enumerated values (I guess from custom tagged value type definition), namespace doesn't disappear when 'Show fully qualified Tags' is disabled
- Added programmatically: neither combobox is presented, nor namespace disappears
1st Question:How can I get this consistent, especially when adding tagged values programmatically? I want to use the tagged value types, as they were defined in the UML-Profile. I also didn't really understand how to use the Type parameter of Collection::AddNew() method for tagged values, the example is somewhat too unclear (a comment for what "Change" is taken from would be useful).
Another issue I have found with my profile definition was, that stereotype extensions for some particular metaclasses don't behave as I expect.
I defined a stereotype to extend the 'Package' metaclass and referred from a toolbox page attibute for it as described in the SDK doc. When I'm importing the profile and add the stereotyped element from the 'Resources' window, it behaves as expected. The rendered toolbox reference doesn't :-(, there's just a stereotype icon shown in the toolbox, that does nothing when dragging it to the diagram.
2nd Question:Did I miss something essential to define a stereotyped package class in the profile, or referencing it from the toolbox page? I did referencing the same way, as for other elements from the profile, that work well.
That's it so far, appreciate if anyone can help ...
WBR
Günther