Chapter 4 Managing Profiles


Edit method

The Edit method allows you to customize the default behavior of the tool in custom forms or the Ellipsis button in the list of extented attributes that displays to the right of the extended attribute in the object property sheet.

You can click the Create Edit Method tool to the right of the list to create a method for the current object and select it for the extended attribute.

You can also click the Properties tool to the right of the list to display the page where you can modify the created method. For more information about methods, see Defining Methods in a Profile.

Example

The following edit method script allows you to show a selection of extended objects having an encryption key stereotype and set the name of the selected extended object in the extended attribute of the current object:

Sub %Method%(obj)
   Dim Mdl, Sel
   
' Retrieve the model
   Set Mdl = obj.Model
   If Not Mdl is Nothing then
     
 ' Create a selection object
      Set Sel = Mdl.CreateSelection
      If Not Sel is Nothing then
         Dim EncryptionKey
        
' Show the object picker dialog for selecting an Encryption key
         Set EncryptionKey = Sel.ShowObjectPicker ("ExtendedObject", "EncryptionKey", "Select an Encryption Key",False)
       
' Retrieve the selection
         If not EncryptionKey is Nothing Then
            obj.SetExtendedAttribute "Encrypted", "true"
            obj.SetExtendedAttribute "EncryptionKey", EncryptionKey.Code
         else
            output "Encryption Key selection cancelled or no Encryption Key defined in the model"
         End If
         Set EncryptionKey = Nothing

' Free the temporary selection
         Sel.Delete
      End If
   End If
   Set Mdl = Nothing
End Sub

 


Copyright (C) 2006. Sybase Inc. All rights reserved.