The following sections outline how to manage the smart package's contents once it is created.

Including elements into a smart package

An element can be included in the smart package in one of two ways:

  • Manually - the user selects to include the particular element. Manually included elements constitute the static contents.
  • Automatically - the element meets the set of criteria defined by the user. Automatically included elements constitute the dynamic contents.

The membership in the smart package is not the UML ownership association. The owner of the element will not change after the element is included in the smart package.

 

To include an element into a smart package manually


Do either:

  • In the Containment tree, select an element and drag it to the smart package.
    See the element included into the contents of the smart package. The element becomes a value of the Additional Elements property as well.

    You can include more than one element at once.

    • To include adjacent elements, select a single element, and then hold down the Shift key while you click any other elements you want to add.
    • To include nonadjacent elements, select a single element, and then hold down the Ctrl key while you click any other elements you want to add.


  • Open the Specification window of the smart package and click the cell of the Additional Elements property value. Then click and in the open dialog, select one or more elements. Click OK when you are done. See the element(s) included in the contents of the smart package.

 

To include elements into a smart package automatically


  1. Open the Specification window of the smart package.
  2. Under the Contents category, click the cell of the Query property value.
  3. Click . The Query dialog opens.
  4. In the dialog, define a set of criteria (query) for gathering the elements into the contents of the smart package.

    For instructions about defining criteria in the Query dialog, refer to Specifying Criteria for Querying Model.


    You can select to show implied relationships (logical relationships calculated from inherited or inner elements of the model element) to provide additional information.


  5. Close the Specification window. See the contents of the smart package updated with elements that meet the defined set of criteria.

    If the contents of the smart package are not updated, select View > Refresh from the main menu.


    • If the smart package contains manually included elements (values of the Additional Elements property), they are joined with the automatically included elements, skipping duplicates.
    • If the smart package has excluded elements (values of the Excluded Elements property), they do not appear in the dynamic contents of the smart package.


Removing elements from a smart package

To remove an element from a smart package


Do either:

  • In the Containment tree, under the smart package, right-click the element. From the shortcut menu, select Delete from Contents or press Delete.

    You can exclude more than one element at once.

    • To exclude adjacent elements, select a single element, and hold down the Shift key while you click other elements you want to exclude.
    • To exclude nonadjacent elements, select a single element, and hold down the Ctrl key while you click other elements that you want to exclude.


  • Open the Specification window of the smart package and click the cell of the Excluded Elements property value. Then click  and in the open dialog, select one or more elements. Click OK when you are done.
  • Open the Specification window of the smart package and click the cell of the Additional Elements property value. Then click  and in the open dialog, unselect one or more elements. Click OK when you are done.

    This is only valid for manually added elements.

    See the element removed from the contents of the smart package, though it is not removed from the model. You can still see the element displayed under the owner of the element in the Containment tree.

     

Freezing the contents of a smart package

If you no longer need the contents of a smart package to be dynamic, you can simply freeze it. The dynamic contents will be converted to the static list of elements and joined with the list of manually added elements (values of the Additional Elements property), skipping both duplicates and elements defined as excluded (values of the Excluded Elements property).

 

To freeze the contents of a smart package


  • In the Containment tree, right-click the smart package with dynamic contents and from the shortcut menu select Freeze Contents.

    See that there are no changes visible in the Containment tree. Open the Specification window of the smart package to see that the values of both the Query property and the Excluded Elements property have passed into empty, and the value of the Additional Elements property stores the new list of elements.

    The contents of the smart package will no longer be automatically updated after relevant changes in the model.


Counting Additional Elements property value after freeze


 

Making a snapshot of the smart package

You can create a copy of the smart package with the static contents, that is, a snapshot.

 

To make a snapshot of a smart package


  1. In the Containment tree, right-click the smart package with dynamic contents and from the shortcut menu select Snapshot Contents. The element Selection dialog opens.
  2. In the dialog, select an owner of the new smart package and click OK.

    See the new smart package created under the selected owner in the Containment tree with the name Snapshot of <smart package name>, for example, Snapshot of My Bookmarks. The contents of the snapshot equal the contents of the smart package, but the list of elements is static.