PowerAda Customizing the Tools Menu

From OC Systems Wiki!
< PowerAda:Project Management with PowerAda
Revision as of 00:36, 25 April 2019 by imported>WikiVisor (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The contents of the Tools pulldown menu are described in a compiled UIL (User Interface Language) file named tools.uid. It is not necessary to be familiar with the UIL language to modify the Tools menu, but you may wish to consult AIX documentation on "The UIL File Format" for additional details.

Through the Tools menu, you can define commands to be executed on files which have been selected in the Powerada browser. To add a command to the Tools menu:

1. Get a local copy of the file tools.uil with

cp $POWERADA/tools/lib/app-defaults/tools.uil .

2. Search forward in the file for the object definition containing:

tools_pulldown : XmPulldownMenu {

Inside the controls clause, add a line like:

XmPushButton tools_new_command;

where tools_new_command is a string you choose which should be descriptive of the new command.

3. At the bottom of the file, just before the end module; line, add a new object declaration like the following:

object
tools_new_command: XmPushButton {
arguments {arguments menus_args;
XmNlabelString = "New Command...";
XmNmnemonic = keysym('N'); };
callbacks {
XmNactivateCallback = procedure
tools_menu_activate("new_command.sh"); };
};

Note that this is identical in structure to similar object declarations in the UIL file, with the following four changes:

  • The first word following the initial object is the string defined in step 2 above.
  • The string in quotes following XmNlabelString is the label that will appear in the menu.
  • The character in single quotes following XmNmnemonic indicates which character in the menu label will be available as an 'accelerator'. This character must be unique among accelerators in this menu.
  • The string in quotes following tools_menu_activate is the command which will be executed when the menu item is selected. The arguments to the command will be the project relative pathnames of files highlighted in the Powerada browser. The first thing the command should do is:
cd $POWERADA_PROJECT_ROOT

4. Save the file to disk and compile it with

uil tools.uil -o tools.uid

5. Move the tools.uid to a directory where it will be found by Powerada. By default, these directories are:

$PWD/ (where PowerAda was started)
$HOME/uid/
$HOME/
$POWERADA/tools/lib/app-defaults/

(The directories are searched in this order.) Alternatively, you may set the UIDPATH environment variable to define an alternate search path. For example, to define the search path described above, set UIDPATH to:

%U:$HOME/uid/%U:$HOME/%U:$POWERADA/tools/lib/app-defaults/%U

6. Tools scripts provided with PowerAda are located in

$POWERADA/../tools/bin/patools

Now when Powerada is started, the new command will appear in the Tools menu, and the defined command will be executed when its entry in the pulldown menu is selected. Standard output and standard error from the command will appear in the Powerada message pane. A good way to test the above procedure is to add a menu item to start an aixterm.

Note that if you elect to install your UIL, UID or command scripts under the $POWERADA directory tree, they may get erased when a new version of PowerAda is installed. Make backup copies of your installation, or use symbolic links to locate the actual files elsewhere.