![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Manipulating Objects Apex provides many tools to manipulate objects. You can perform the following kinds of operations on objects:
- Create an object
- Save an object
- Open an object
- Print an object
- Delete an object
- Copy an object from one directory to another, or from one file to another in the same directory
- Move an object
About This Chapter
This chapter describes the Apex object manipulation commands. Specifically, the topics covered in this chapter are:
- Creating an Object
- Saving an Object
- Opening an Object
- Printing an Object
- Deleting an Object
- Copying an Object or View
- Moving an Object
Creating an ObjectCreating a new object in a system is a common operation, especially when the system is first being written. An object is simply a UNIX file, so it can be created in many ways. Apex provides some operations for creating new units that bundle several steps that you might want to follow in a single operation. There is no requirement that units be created using Apex operations, however.
You can create, copy, open, save, and delete Apex objects by selecting commands from the File menu. To create an object, choose File > New item from the directory viewer File menu. Apex opens a cascading menu offering the choices.
File Suffixes
Apex uses standard suffixes to indicate the file type. When a file is created using Apex, it is automatically created with the proper suffix as specified in Table 4.
The File > New Menu
The File > New menu provides a cascade, which has operations for creating a number of kinds of objects described in Table 5.
There is support for creating program units in several languages as well as creating text files.
Usually new objects will be placed under configuration management control. This can be done automatically when creating objects using Apex, but must be done as a separate operation when objects are created outside of Apex using UNIX commands.
Creating a Directory
To create a new directory, select New from the File menu and choose the New Directory menu item. Apex opens a dialog box named New Directory.
To create a directory with the New Directory dialog box, fill in the name of the directory and click OK or Apply. The New Directory dialog box illustrated in Figure 13 will create the directory /apex/projects/avionics/navigation. The New Directory dialog box does not contain a Make it controlled check box, as the New File dialog box does, because directories cannot be controlled.
Figure 13 New Directory Dialog Box
![]()
Creating a Text File
When you select the New item from the File menu and choose New File, Apex opens a dialog box named New File.
When the New File dialog box opens, you can create a new file by inputting the name of the new file in the Name field and clicking OK or Apply. The New File dialog box illustrated in Figure 14 creates the file ...library.ss/rev.1.wrk/log.
Figure 14 New File Dialog Box
![]()
Creating an Ada Unit (Ada only)
Creating Ada units is done using the File > New > New Ada command. To create a new Ada unit, follow these steps.
- 1 . Click on File > New > New Ada to bring up a New Ada dialog box.
- 2 . Set the option menus to show the type of Ada unit your are creating.
- 3 . If you executed the File command from the directory viewer of the working view (Apex/Summit) or Rational subsystem (Apex/ClearCase) that is to contain the Ada unit, the context would be correct. If it is not, set the context to the appropriate working view/Rational subsystem.
- 4 . Enter the package name in the Name field.
- 5 . If you want to have the new unit under configuration management control, check the Place Under Control (Apex/Summit) or Make it an Element (Apex/ClearCase) check box.
- 6 . Often the next step will be to type in the unit. To have the new window editor window come up, click on Visit It.
The New Ada dialog box illustrated in Figure 15 creates the procedure body /apex/tutorial.ss/hello.wrk/hello.2.ada using Apex/Summit. When units are created using the File > New > New Ada command, the new file is initialized with the contents of a template from the model. In this way, new files can have a common skeleton.
Figure 15 New Ada Dialog Box - Apex/Summit
![]()
For Apex/Summit:
A view is either an Ada view or a C/C++ view. C/C++ code cannot be compiled in a view with an Ada model and Ada code cannot be compiled in a view with a C/C++ model. All code must be in a view to be compiled using Apex.
For Apex/ClearCase:
All code must be in a Rational Subsystem for compiling.
Creating a C++ File
To create a new header or implementation file for C++, select the File > New cascading menu and choose the New C++ menu item. Apex opens a dialog box named New C++ illustrated in Figure 16.
Figure 16 New C++ Dialog Box
![]()
The option-menu button that is labeled Class when the New C++ dialog box opens lets you create a Class, Template Class, Template Function, file, or Main implementation file. The option-menu button labeled Header lets you create a C++ header file, a C++ implementation file, or both.
The Name text field is used to specify a C++ name. The Filename field is used to specify a filename. Apex adds an .h or .C suffix as required. The Context field specifies where to create the new file(s).
For Apex/Summit:
A view is either an Ada view or a C/C++ view. C/C++ code cannot be compiled in a view with an Ada model and Ada code cannot be compiled in a view with a C/C++ model. All code must be in a view to be compiled using Apex.
For Apex/ClearCase:
All code must be in a Rational Subsystem for compiling.
Creating a C File
To create a C implementation or header file, select the File > New cascading menu and choose the New C menu item. Apex opens a dialog box named New C illustrated in Figure 17.
Figure 17 New C Dialog Box
![]()
The option-menu button that is labeled File when the New C dialog box opens lets you create a file or Main implementation file. The option-menu button labeled Implementation lets you create a C++ header file, a C++ implementation file, or both.
The Name text field is used to specify a C++ name. The Name field is used to specify a filename. Apex adds a .h or .c suffix as required. The Context field specifies where to create the new file(s).
For Apex/Summit:
A view is either an Ada view or a C/C++ view. C/C++ code cannot be compiled in a view with an Ada model and Ada code cannot be compiled in a view with a C/C++ model. All code must be in a view to be compiled using Apex.
For Apex/ClearCase:
All code must be in a Rational Subsystem for compiling.
Saving an ObjectWhen you choose Save from the directory-viewer window's File menu, Apex saves all objects selected in the window, using their current names and saving them in their current directories.
To save an object under a different name:
- 1 . Choose the Save As command from the directory viewer window's File menu. Apex opens the Save As dialog box illustrated in Figure 18.
Figure 18 Save As Dialog Box
![]()
- 2 . Save the object under its new name by typing that new name in the text field labeled Object Name.
The three icons to the right of the two input fields are (left to right) the Navigator Icon, the History Icon, and the Completion Icon. To learn more about these icons, see Dialog Box Icons.
- 3 . In the Context text field, input the name of the directory for the new object.
- 4 . To save the object under its new name, click the OK or Apply button in the Save As dialog box.
Opening an ObjectThere are several ways to open an object from the directory-viewer window. You can:
- Select the line that contains the name of the object and click Visit in the button bar.
- Double-click the name of the object shown in the directory viewer.
- Choose the File > Open menu item. The kind of window you open depends on the kind of object you select.
- If you are creating the object using the File > New command, set the Visit it check box in the File New dialog box that you use to create the object.
The kinds of windows displayed when you open various kinds of objects are described Table 6.
When you select the File > Open menu item, Apex displays the Open dialog box, which is described in The Open Dialog Box. You can use the Open dialog box to find and open any available file. Opening a file using the Open dialog box is illustrated in Figure 19.
Figure 19 Open Dialog Box
![]()
Printing an ObjectChoosing Print from the File menu opens the Print dialog box. With the Print dialog box, you can print text files on a printer with a variety of formatting options. The Print dialog box is illustrated in Figure 20.
Figure 20 Print Dialog Box
![]()
- 1 . Type the name of the file you want to print in the Print Files text field or navigate to the file you want to print by using the Navigator Icon next to the Print Files text field. The default is the currently selected file.
- 2 . When the name of a file you want to print appears in the Print Files text field, click Add to add the name of the file to the list of files in the Print Files text field. (To remove the name of a file from the scroll box, select the name of the file and click Remove.)
- 3 . If the name of the printer you want to use is not in the Printer text field, use the icons next to the Printer text field to select the printer you want to use, or type the name of the printer in the text field.
By default, the printer that appears in the Printer text field is the printer currently specified by the PRINTER UNIX variable.
- 4 . If the format you want to use for your printing is not in the Format text field, use the icons next to the Format text field to select the format you want to use, or type the exact name of the format you want to use in the text field.
- 5 . Use the Options text field to select certain printing options.
To select an option, use the icons next to the Options text field or type the name of the option you want to use in the text field. The options are passed as command-line options to the printing command specified in the Format text field.
- 6 . Use the Media text field to select additional printing options. (Only available if Formatted is selected in the Format text field.)
Use this field to specify the paper size to be used for printing (A4 or Letter). To select a value for this field, use the icons next to the Media text field or type the name of the Media option you want to use in the text field. This value are passed as command-line options to the printing command specified in the Format text field.
- 7 . Click OK or Apply to start printing.
Deleting an ObjectWhen you choose the Delete Object command from the File menu, Apex displays the Delete Object dialog box illustrated in Figure 21.
Figure 21 Delete Object Dialog Box
![]()
Copying an Object or ViewApex/Summit
The Apex Copy command copies an object and updates the relevant Apex information. To copy an object, choose Copy from the File menu. Apex displays the Copy Object dialog box illustrated in Figure 22.
Figure 22 Copy Object Dialog Box - Apex/Summit only
![]()
- 1 . Click the Copy Objects radio button at the top of the dialog box to copy any objects (files, subsystems, etc.) except views. Click the Copy Views radio button to copy a system configuration or views and to alter the view characteristics during the copy.
- 2 . Type the name of the object to be copied into the text field or select an object from the list field. You can also navigate to the desired object by clicking the Navigator Icon next to the Copy Objects text field (see Dialog Box Icons).
- 3 . Type a destination pathname in the Destination text field to specify the destination of an object being copied. Alternatively, you can navigate to the destination directory by clicking the File Locator Icon next to the Destination text field.
The tab panels, like the one labeled Control, are designed to be used when objects managed by the Rational Apex/Summit system are being copied. To learn about the options you can set using these controls, see Using and Customizing Summit/CM.
Moving an ObjectApex/Summit
The Apex Move command moves an object and updates all the relevant Apex information. To move one or more objects selected in the directory-viewer window, choose the Move command from the File menu. Apex displays the Move Object dialog box illustrated in Figure 23.
Figure 23 Move Object Dialog Box
![]()
To specify the names of objects you want to move and their destinations, follow the same procedures outlined for the File > Copy command in Copying an Object or View.
If you check the Copy Version History If Controlled check box and the object you want to copy is controlled, Apex copies the object's version history family as well as the object itself. To learn about version history families, see Creating a Version History Family in Using and Customizing Summit/CM.
Rational Software Corporation http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2002, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |