|
|
Model Element Editor |
When invoked on a model element, the helper first checks for and reads any currently loaded maps (see Model Element Editor Map Builder).
If the project has a stereotype applied to it and that stereotype has a map, then that specific map is used. Otherwise, all maps in currently loaded profiles are checked.
Elements read from the map are presented in tabs according to the map layout. Currently supported elements are as follows:
· Tags
· Dependencies
· Relations (that is stereotypes applicable to AssociationEnd)
· Owned (that is nested) elements.
A sample model that highlights the various supported model elements is supplied with the profile (RhapsodyPowerPack/Samples/ModelElementEditor)

Model Element Editor
Tags do not require a map in Full Mode but a map may still be used to organize them.
If tags exist that are not defined in the map (or no map is present) then by default they are presented on an additional tab in the Model Element Editor. The name of the tab may be modified using the following property (set this at project level):
RhapsodyPowerPack.ModelElementEditor.UnmappedTagsTabName
This behaviour may be controlled using the following two properties:
RhapsodyPowerPack.ModelElementEditor.AddTagsForElementWithNoMap
RhapsodyPowerPack.ModelElementEditor.AddUnmappedTagsToTab
Both properties should be set at project level and both properties can control whether the additional tab is presented. The first property will hide the tab if the element being edited does not appear in the map at all, the second hides the tab if the element is in the map but has tags which are not in the map.

Model Element Editor Unmapped Tags
Type directly into the Name field to edit the name of the stating element. Note that changes are not applied until you hit Enter (to prevent any error messages from Rhapsody for invalidly typed names). Note that the title of the editor indicates the type of model element you are editing:

If the element is an object, then an additional field allows the type of the object to be set/changed:

For Tags, either in a map or unmapped, the Model Element Editor reads the type and multiplicity of the Tag.
Basic types such as String or Integer are presented as text boxes. Typing into a text box updates the Tag immediately. Clearing the text field will reset the tag, setting it back to un-overridden.
Boolean types are presented as checkboxes. Selecting / clearing a value updates the tag immediately. A defect in the Rhapsody API makes it impossible to detect what the default value of a Boolean Tag should be, so clearing/selecting a tag will always leave it in the overridden state.
![]()
Tags typed by model elements or new term stereotypes cause the Model Element Editor to read the model and present a combo box of all possible values. Multiplicities are supported:
For tags with multiplicity 1 this is a single-select combo box. Selecting a value will set the tag value immediately. Selecting the empty row will reset the tag, setting it back to un-overridden.

For Tags with multiplicity greater than 1, a multi-select combo box is presented. The upper-multiplicity of the Tag is checked, and the Model Element Editor will not allow elements to be added that would exceed that multiplicity (once the multiplicity has been reached, all other options become greyed out).

Context Pattern Tags are a special case but are edited in the exact same way as tags typed by model elements:

Proposed String Value Tags are another special case where a basic string tag can be ‘converted’ into a combo box:

Only Relations and Dependencies defined in maps are supported. Dependencies may either new terms or non-new terms. Relations must be new terms. The Targets property of the Dependency/Relation Stereotype must be defined to allow the Model Element Editor to find elements of the appropriate type to present (Targets may be base terms such as Actor or new terms). Note that while Rhapsody ignores the Targets property for non-new term stereotypes, the Model Element Editor does not. In addition, the map may define a multiplicity for the dependency/relation, in which case the model Element Editor behaves just as it does for tags with multiplicity. This is very powerful as it provides guidance as to how many dependencies/relations of a specific type are allowed.

Stereotype Applicable To Dependency with Targets Property Set to Actor

Single-select
Combo Box for Dependency with Targets: Actor

Stereotype Applicable To Dependency with Targets Property Set to New Term Country

Multi-select
Combo Box for Dependency with Targets: Country
In the case of single-selection combo boxes, selecting the empty row will delete the dependency/relation from the model. For multi-select combo boxes, clearing a checkbox will delete that dependency/relation from the model.
By default, new term relations applicable to AssociationEnd are directional associations. To change the type, set the following property on the new term stereotype:
Model.Stereotype.AlternativeDrawingTool
Valid values are:
· Aggregation
· Composition
· Directed Composition
· Directed Association
This will ensure that the created elements have the correct icon in the Rhapsody model browser. Note however that the Model Element Editor always creates directional relationships, so Composition is the same as Directed Composition as far as this helper is concerned.
Nested elements must be present in the map. If no existing nested elements are present, then a combo box allows their creation:

Existing or newly created nested elements are presented in sub-tabs:

The Model Element Editor respects any multiplicity of nested elements defined in the map and greys out invalid choices, for example this sample map defines that a Car may have only one driver – having added one, that option becomes greyed out:


Combo boxes may be sorted
and filtered
All editable fields provide navigation back to Rhapsody.