Chapter 4 Managing Profiles


Method properties

When you create a method, you have to select the appropriate metaclass where to create it. This will determine the method scope. For example, if you want a method to apply to classes and interfaces, you should define it in the Classifier metaclass.

When you create a method, you have to define the following properties:

Property Description
Name Name of the method that identifies a script
Comment Additional information about the method

The Method Script tab is used to define the body of the method function.

The Global Script tab is used for sharing library functions and static attributes in the resource file.

You can also use the Global Script tab to declare global variables. But in this case, you must be aware that global variables are not reinitialized each time the method is executed. They keep their value until you modify the resource file, or until the end of the PowerDesigner session. This may cause errors especially when variables reference objects that can be modified or even deleted. Make sure you reinitialize the global variable at the beginning of a method if you do not want to keep the value from a previous run.

For more information on defining a script and using the Global Script tab, see the "Defining the script of a custom check" and "Using the global script" sections.

Methods can be used as commands in user-defined menus. It is thus important to create methods before menus.

For more information on menus, see the "Defining Menus in a Profile" section.

 


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