Creating custom symbolic view definitions
See the following procedures for custom symbolic view definition creation with custom and/or inherited view palettes, and predefined and/or custom templated buttons in custom and/or inherited button categories.
The procedures on this page use the example of creating custom symbolic view definitions by customizing the DS_Views::CoreViews::bsv standard predefined symbolic view definition. This is the recommended workflow for creating custom symbolic view definitions, as the Base Symbolic View definition carries the predefined view palette, which contains Selection, Tools, and Common button categories, as well as the rendering feature, providing a flexible basis for creating custom symbolic view definitions. However, you can similarly customize any other symbolic view definition, whether predefined or custom.
Updating custom view definition
Reload the project for changes made to the custom symbolic view definition to take effect.
Creating custom symbolic view definitions
To create custom symbolic view definitions
- In the Containment tree, create a new root namespace.
- Open the Textual Editor for the new namespace.
- In the Textual Editor, create a package and name it.
- Within the body of the package, import the DS_UIComponents::CoreUIComponents::Palette package.
- Declare a view definition, specify the name for the new symbolic view definition, subclassify the Base Symbolic View definition from the DS_Views::CoreViews package, then create a custom view palette within the body of the view definition.
- Click the Synchronize button.
The new view definition becomes available in the View Creation dialog/submenu once you:
package 'Custom symbolic view definitions' { // package for the custom symbolic view definition(s)
private import DS_UIComponents::CoreUIComponents::Palette::*;
view def 'Requirements View' :> DS_Views::CoreViews::bsv { // new custom symbolic view definition 'Requirements View' subclassifying 'bsv', i.e., 'Base Symbolic View' definition
// specify the view palette here
}
}
Creating palettes for custom symbolic view definitions
To create palettes for custom symbolic view definitions
- Within the body of the view definition element of the new symbolic view definition, redefine the baseViewPalette inherited from the Base Symbolic View definition.
- Specify button categories by doing any of the following:
- Click the Synchronize button.
view def 'Requirements View' :> DS_Views::CoreViews::bsv { // new custom symbolic view definition 'Requirements View'
part :>> baseViewPalette { // redefines the baseViewPalette inherited from the Base Symbolic View definition. The custom palette now inherits Selection, Tools, and Common button categories
// specify button categories here
}
}
Managing button categories in custom symbolic view palettes
The procedures in this subsection explain how to manage inherited and custom button categories and their attributes.
Removing inherited button categories
To remove inherited button categories
- Place the cursor within the body of the part element redefining baseViewPalette.
- Declare a part usage, specify the element name (optional), and then redefine the button category you want to remove.
The button categories that are inherited from the baseViewPalette are selectionCategory, toolsCategory, and commonCategory. You can find them in the DS_Views::ViewPalettes package. You can also find the button categories in the General button categories table.
- Set the redefining button category's multiplicity to zero.
- Click the Synchronize button.
view def 'Requirements View' :> DS_Views::CoreViews::bsv {
part :>> baseViewPalette {
part :>> toolsCategory [0]; // unnamed part redefines toolsCategory inherited via baseViewPalette, specifying the redefining button category's multiplicity to zero to remove it
}
}
Adding custom button categories
To add custom button categories
- Place the cursor within the body of the element redefining baseViewPalette.
- Declare a part usage, specify the element name, and then subset buttonCategories.
- Within the new button category's body, do any of the following:
- Click the Synchronize button.
view def 'Requirements View' :> DS_Views::CoreViews::bsv {
part :>> baseViewPalette {
part requirementsCategory :> buttonCategories; // new button category instance
}
}
Specifying attributes for custom or inherited button categories
To specify attributes for custom or inherited button categories
- Within the body of the button category element, redefine the attributes that you want to modify with the needed values.
All button categories - inherited and custom ones - inherit all the same button category attributes from DS_UIComponents::CoreUIComponents::Components::AbstractItem and ItemsCategory, which are: isCollapsed, hasVisibleLabels, label, description. You can also find the attributes in the General button categories table.
- Click the Synchronize button.
view def 'Requirements View' :> DS_Views::CoreViews::bsv {
part :>> baseViewPalette {
// modifying an inherited button category's attributes:
part :>> selectionCategory {
attribute :>> label default "Selection"; // modified category name
attribute :>> isCollapsed default true; // modified category default collapse state
}
// specifying a custom button category's attributes:
part requirementsCategory :> buttonCategories {
attribute :>> isCollapsed default false; // newly specified isCollapsed attribute for the custom button category
attribute :>> hasVisibleLabels default true; // newly specified hasVisibleLabels attribute for the custom button category
attribute :>> label default "Requirements"; // newly specified label attribute for the custom button category
attribute :>> description default "Requirements"; // newly specified description attribute for the custom button category
}
}
}
Managing buttons in button categories
A button category can contain specific and/or menu buttons that contain specific buttons in its submenu. You can also specify one of the submenu buttons as the focused button that would be displayed as the default one for the menu button. Additionally, you can create templates for custom buttons, allowing you to add custom templated buttons to custom and/or inherited button categories.

The image displays the custom button category 'Requirements' that contains multiple category-specific buttons. 'requirement' (as well as 'software requirement' and 'constraint') is a menu button with submenu buttons.
The 'requirement' button is displayed as the default one for the menu button.
Creating menu buttons in button categories
To create menu buttons in button categories
- Place the cursor within the body of the button category element.
- Declare a part usage, specify the element name, define it by ButtonsCategory, and then subset abstractButtons.
- Add submenu buttons for the menu button:
- (Optional) Specify the focused button:
- Redefine focusedButton, and specify the focused button by indicating the name of the needed button's part element.
- Click the Synchronize button.
view def 'Requirements View' :> DS_Views::CoreViews::bsv {
part :>> baseViewPalette {
part requirementsCategory :> buttonCategories {
part reqButtonMenu : ButtonsCategory :> abstractButtons { // menu button instance
part reqButton : Button :> abstractButtons { // submenu button
perform action : DS_UIComponents::CoreUIComponents::Operations::OperationFromCode :> operation { in = DS_Views::ViewPalettes::CodeActionIdentifiers::requirementAction; }
}
part reqDefButton : Button :> abstractButtons { // submenu button
perform action : DS_UIComponents::CoreUIComponents::Operations::OperationFromCode :> operation { in = DS_Views::ViewPalettes::CodeActionIdentifiers::requirementDefAction; }
}
part :>> focusedButton = reqButton; // the part reqButton is specified as the focused (default) button for the menu button
}
}
}
}
Adding predefined buttons to custom or inherited button categories or menu buttons
To add predefined buttons to custom or inherited button categories or menu buttons
- Do one of the following:
- To create specific buttons, place the cursor within the body of the button category element.
- To create submenu buttons for the menu button, place the cursor within the body of the menu button element.
- Declare a part usage, specify the element name, define it by Button, and then subset abstractButtons.
- Within the body of the part, declare a perform action, define it by DS_UIComponents::CoreUIComponents::Operations::OperationFromCode, and subset operation. In the element's body, specify the in direction with the code action identifier based on the type of element you want the button to create.
You can find the needed code action identifier for the element kind you want the button to create in the DS_Views::ViewPalettes::CodeActionIdentifiers package. It looks like this:
attribute requirementAction : ScalarValues::String = "ADD_REQUIREMENT"; // the code action identifier for the requirement usage element button is requirementAction
- Click the Synchronize button.
view def 'Requirements View' :> DS_Views::CoreViews::bsv {
part :>> baseViewPalette {
part requirementsCategory :> buttonCategories {
part reqButtonMenu : ButtonsCategory :> abstractButtons { // menu button instance
part reqButton : Button :> abstractButtons { // submenu button
perform action : DS_UIComponents::CoreUIComponents::Operations::OperationFromCode :> operation { in = DS_Views::ViewPalettes::CodeActionIdentifiers::requirementAction; } // specifies requirementAction so that this button creates the requirement usage element
}
part reqDefButton : Button :> abstractButtons { // submenu button
perform action : DS_UIComponents::CoreUIComponents::Operations::OperationFromCode :> operation { in = DS_Views::ViewPalettes::CodeActionIdentifiers::requirementDefAction; } // specifies requirementDefAction so that this button creates the requirement definition element
}
part :>> focusedButton = reqButton;
}
}
}
}
Removing buttons from inherited button categories
To remove buttons from inherited button categories
- Place the cursor within the body of the element redefining baseViewPalette.
- Declare a part usage, specify the element name (optional), and then redefine the button you want to remove.
See the buttons specified for each predefined button category in the DS_Views::ViewPalettes package. You can also find it in the General button categories table.
- Set the redefining button's multiplicity to zero.
- Click the Synchronize button.
view def 'Requirements View' :> DS_Views::CoreViews::bsv {
part :>> baseViewPalette {
part :>> selectionCategory { // unnamed part redefines selectionCategory inherited via baseViewPalette
// ------ predefined button:
part completeCoverageModeButton : DS_UIComponents::CoreUIComponents::Palette::Button :> abstractButtons
// ------ modified button (instead of the notation above):
part :>> completeCoverageModeButton [0]; // multiplicity for the button completeCoverageModeButton is set to zero to remove it
}
}
}
Managing custom templated buttons in button categories
Instead of or in addition to using predefined buttons either by adding them to your custom or inherited button categories, you can also create your own custom buttons. For that, first, you need to create a template for the custom button, and then you can add it to a specific button category of the view palette.
Creating templates for custom buttons
The following procedure depicts how to create an element template using metadata to extend the requirement usage element with the needed attribute, where the requirement usage element is named Software. Then the template can be passed into the custom button specification using metadataAccessExpression.
To create templates for custom buttons
- Within the package containing the new symbolic view definition, declare:
- A metadata definition element with the needed name and attributes.
- A package element for the template.
- Within the template element, apply metadata to the element kind you want to extend and specify the element name.
- Click the Synchronize button.
package 'Custom symbolic view definitions' {
metadata def Software { // declared metadata definition with the needed attribute
attribute verificationMethod [0..*] : VerificationMethod;
}
package softwareReqTemplate { // custom button template
#Software requirement softwareRequirement; // the metadata Software is applied to the requirement usage element extending it with a new name Software and a metadata attribute. The name softwareRequirement will be used for the perform action's element specification to pass the template to a button in a button category
}
}
Adding custom templated buttons to custom or inherited button categories or menu buttons
To add custom templated buttons to custom or inherited button categories or menu buttons
- Do one of the following:
- To create specific buttons, place the cursor within the body of the button category element.
- To create submenu buttons for the menu button, place the cursor within the body of the menu button element.
- Declare a part usage, specify the element name, define it by Button, and then subset abstractButtons.
- Within the body of the part, specify attributes for the custom templated button:
- Redefine the label attribute and specify the button name.
- Redefine the description attribute and specify the button's tooltip.
- Declare a perform action, define it by DS_UIComponents::CoreUIComponents::Operations::OperationFromTemplate, and subset operation. In the element's body, specify the in direction with the custom button's template path using metadataAccessExpression.
- A metadataAccessExpression must be used for the in element. Its result must be exactly one templated element that you want to copy for the button.
- Alternatively, you can also use metaclassification expressions, e.g., when the templated element is unnamed. The expression would be: (softwareReqTemplate meta KerML::Element).ownedElement
- Click the Synchronize button.
view def 'Requirements View' :> SysMLStandardViews::bsv {
part :>> baseViewPalette {
part requirementsCategory :> buttonCategories {
part softwareButton : Button :> abstractButtons { // menu button instance
attribute :>> label = "software requirement"; // specify the button name
attribute :>> description = "software requirement"; // specify the button tooltip
perform action : DS_UIComponents::CoreUIComponents::Operations::OperationFromTemplate :> operation { in = softwareReqTemplate::softwareRequirement . metadata; } // OperationFromTemplate specifies that the indicated button is templated; in specifies the created element, which is softwareRequirement (which also contains metadata) from the template softwareReqTemplate
}
}
}
}