|
|
Context Pattern Editor |
This helper provides an easy way to create and edit context patterns for table layouts and queries.
|
Applicable To |
Table
Layout, Query, Custom Browser* |
|
Menu
Entry |
Power
Pack Edit Context Pattern |
|
Demonstration |
*Custom Browsers are new terms in the Rhapsody Profile Builder, used to model and generate custom model browsers.
For an overview of context patterns, see: Context Patterns
When launched, the editor:
· Reads the model for stereotypes
· Checks for any existing pattern
· Presents the editor
Its behavior may be configured using properties which may be set either at project or package level. The Rhapsody Power Pack property perspective includes a tab specifically for this editor:

The look and feel of the editor may be controlled using Themes.
The Context Pattern Editor provides a tabular way of describing the context pattern:

For a description of each column, see below:
Each cell has custom editors depending on the value in another cell – these are explained in the linked pages above. The Pickers section of the UI has several buttons that become available depending on the current selection.

Current selected row is Metaclass

Current selected row has Constraint Type
Rows may be dragged to re-order the pattern. Note that to perform a drag the row(s) must first be selected by clicking them (multiple select is supported). Whilst technically any field may be used for dragging, clicking a combo box field will open that combo box so in general it is better to use the first column with the drag symbol to perform a drag.
Clicking apply will apply the pattern to the current selection. If the selection is a table layout and that table layout has no columns, then the helper automatically creates new columns for the pattern.
Patterns may be reused:
· Launch the editor from one layout / query.
· Select another layout / query in the model browser.
· In the Context Pattern Editor, press Change Selection.
Note that if the new selected element is a different type than the first some of the fields may be unused (e.g. Capture) and you may need to enter names for table tokens if you want them captured. This also works if you switch projects within the same Rhapsody instance, allowing you to copy patterns and paste them into other projects.
By default, the editor looks for stereotypes in:
· All currently loaded profiles
· The PredefinedTypes package
· The metaclass text file
The metaclasses file is a text file containing the available terms. By default, the editor reads the metaclasses.txt file that is provided with the Rhapsody Power Pack, however this may be modified (or disabled entirely) using the following properties.
RhapsodyPowerPack.ContextPatternEditor.IncludeMetaclassesList
RhapsodyPowerPack.General.MetaclassesFile
The properties may be set at project or package level. A custom metaclasses file should include all the fundamental terms to be utilized, with each metaclass being listed on a separate line.
The Rhapsody PredefinedTypes package contains stereotypes such as <<trace>>. By default, the editor looks for stereotypes in that package, but this may be disabled using the following property:
RhapsodyPowerPack.ContextPatternEditor.IncludePredefinedTypes
If you have stereotypes outside of profiles, or if some of the profiles are large and not necessarily needed, the scope of the editor may be modified by setting the following property:
RhapsodyPowerPack.ContextPatternEditor.IncludeMetaclassesInPackages
If this property is not empty, then the editor does not look in profiles but only the packages specified. The property is a comma separated list of full paths, for example:
PackageA::PackageB,ProfileA::DiagramsPkg
Note that the project name is not part of the full path.
If the layout or query already has a pattern, then that pattern is used to populate the Context Pattern Editor table. If no pattern exists, then the following properties are used to populate an initial set of rows:
Initial populate ion may be enabled / disabled by setting the following property to true / false:
RhapsodyPowerPack.ContextPatternEditor.StartTableWithDefaultTableRows
RhapsodyPowerPack.ContextPatternEditor.StartTableWithDefaultQueryRows
If either of these are set to true, then the corresponding property below may be used to define the starting rows:
RhapsodyPowerPack.ContextPatternEditor.DefaultTableRows
RhapsodyPowerPack.ContextPatternEditor.DefaultQueryRows
The above properties should contain a series of strings (one for each desired row) separated by a semi-colon. Each string should contain the desired tokens, separated by forward arrows (>), in the same order as the table columns from left to right.
The order of entries in the string should match the other of columns in the table:
|
Name |
Token Type |
Token Value |
Occurrence |
Strict |
Target |
Capture |
The possible values for each field are:
· Name : Any string
· Token Type: Metaclass / Relation / Plugin
· Token Value : Any string
· Occurrence : empty / Zero or More / One or More
· Strict : Empty / Strict / Very Strict
· Target : true / false
· Capture : true / false
NOTE: In this version Constraints are not supported. This functionality may be added in a later version.
Columns are specified in order, but empty columns are allowed and not all columns need be specified, (that is columns to the right that are not specified will use default values) for example:
prj > Metaclass > Project > Zero or More ;
pkg > Metaclass > Package > One or More ;
blk > Metaclass > Class > > Very Strict ;
ref > Relation > references > > > true
> Stereotype > trace
By default, a table created from a table layout in Rhapsody starts with the project as its scope, but this may be changed to owner or package. Taking this into account, the default starting pattern for a table layout is:
prj > Metaclass > Project > Zero or More ;
pkg > Metaclass > Package > One or More
This creates a pattern that will work whether the table scope is set to Project, Owner or a specific package.
Queries automatically start with Project (so if the pattern starts with Project this query will fail) and so the default starting pattern for a query is:
> pkg > Metaclass > Package > One or More
Note that the starting character is > since the name field isn’t used in query patterns and so is an empty column