Chapter 4 Managing Profiles
When you create a method, you have to define the method function in the Method Script tab. The Global Script tab is also available and allows you to reuse functions and sub-procedures. This tab is shared with event handlers and transformations.
You type the script of a custom check in the Method Script tab of the method properties. By default, the Method Script tab displays the following script items:
For example, you can create a method for a class that converts classes into interfaces. The following script copies class basic properties and operations, deletes the class to avoid namespace problem and creates the new interface. Note that the script does not deal with other class properties, nor interface display.
Sub %Mthd%(obj)
' Convert class to interface
' Copy class basic properties
Dim Folder, Intf, ClassName, ClassCode
Set Folder = obj.Parent
Set Intf = Folder.Interfaces.CreateNew
ClassName = obj.Name
ClassCode = obj.Code
Intf.Comment = obj.Comment
' Copy class operations
Dim Op
For Each Op In obj.Operations
' ...
Output Op.Name
Next
' Destroy class
obj.Delete
' Rename interface to saved name
Intf.Name = ClassName
Intf.Code = ClassCode
End Sub
To create a method:
| Copyright (C) 2005. Sybase Inc. All rights reserved. |
| |