620 likes | 644 Views
Editing and Debugging Mumps with VistA and the Eclipse IDE. Joel L. Ivey, Ph.D. Dept. of Veteran Affairs OI&T, Veterans Health IT Infrastructure & Security Service. Objectives. What is Eclipse? Do I need to know any Java? (NO!) A functional MUMPS (or M) editor with syntax coloring.
E N D
Editing and Debugging Mumps with VistA and the Eclipse IDE Joel L. Ivey, Ph.D. Dept. of Veteran Affairs OI&T, Veterans Health IT Infrastructure & Security Service
Objectives • What is Eclipse? • Do I need to know any Java? (NO!) • A functional MUMPS (or M) editor with syntax coloring. • Setting it up • Options & Features • Examples of its use 15th VistA Community Meeting
What Is Eclipse? • Eclipse is an Integrated Development Environment (IDE). • It is written in Java, and was originally a Java development environment. • It uses a plug-in architecture to provide for extension of the capabilities. • It is now used as an editor and development environment for many languages. 15th VistA Community Meeting
Do I have to know any Java? NO!! 15th VistA Community Meeting
How do I get and Install Eclipse? • Eclipse was originally developed by IBM, but was converted to an open source project. • The most recent version can be downloaded as a zip file from http://www.eclipse.org. • Simply unziping the file (with ‘use folder names’ checked) into a desired directory such as C:\ or C:\Prog results in Eclipse being put into C:\Eclipse or C:\Prog\Eclipse. • Start Eclipse by double clicking on the Eclipse.exe program in the Eclipse directory. 15th VistA Community Meeting
The Eclipse Editor on first use 15th VistA Community Meeting
The Basic Eclipse Editor (after clicking on the ‘Go To Workbench’ arrow) 15th VistA Community Meeting
Unzipping the VistALink Plug-in 15th VistA Community Meeting
The M icon and VistA menu added by the M-Editor Plug-in 15th VistA Community Meeting
The VistA menu Items 15th VistA Community Meeting
Setting VistA Preferences -1 15th VistA Community Meeting
Setting Preferences for the VistALink Connection 15th VistA Community Meeting
Setting Preferences for the M-Editor functionality 15th VistA Community Meeting
After Clicking OK for the Preferences and then Clicking on the Green ‘M’ icon 15th VistA Community Meeting
After Selecting the Routine, You have to sign on to the server 15th VistA Community Meeting
And the routine is loaded 15th VistA Community Meeting
The center section is the editing area, and multiple routines may be open at one time (tabs) 15th VistA Community Meeting
The Left Panel contains projects – only files which are in a project may be edited – the default is mcode. An ‘m’ extension is used for the files. 15th VistA Community Meeting
The right panel contains an outline of routine tags. Selecting one of these will jump to that location in the routine. 15th VistA Community Meeting
Adding a new section of code. The error is intentional. 15th VistA Community Meeting
The left gutter is marked where lines have been added or changed. The tab is also marked to indicate a modified routine. 15th VistA Community Meeting
The outline also shows the added tag. 15th VistA Community Meeting
On saving the routine (cntrl-S or the icon), it indicates an error encountered. 15th VistA Community Meeting
The problems are identified in the M-Editor Console at the bottom. It points out the error, and several variables which are at risk (neither arguments or newed). 15th VistA Community Meeting
On saving a routine • The routine is written to the project (mcode by default). • The server is checked to insure that the routine on the server hasn’t changed since it was loaded into Eclipse. • If the server version hasn’t changed (or you approve the write over), the routine is saved on the server. • The part of XINDEX checking for errors is run with the routine. Any warnings or errors cause a dialog box to pop-up to insure that the user is aware of the problems. 15th VistA Community Meeting
On Saving A Routine - 2 • The routine is checked for variables which are not arguments and which have not been newed. In most cases, you probably want to protect them. • Variables which are expected to be visible outside the routine can be identified with a special comment e.g. ; ZEXCEPT: IO,DUZ KERNEL VARIABLES • If an M-Unit test has been identified for the routine, the unit test is run and the roll & scroll results are shown (periods for passed tests, Texts for failures or errors). 15th VistA Community Meeting
On Saving A Routine - 3 • The default action on saving is to enter or update the routine in the ROUTINE file, and to update the date and time for the routine on the first line. 15th VistA Community Meeting
So, I fixed the error and NEWed the variables. 15th VistA Community Meeting
On Saving again • A dialog box appeared indicating no problems identified. 15th VistA Community Meeting
Some Benefits of the Project Entries • The mcode project in the left panel now contains the most recent version of the routine that was edited. • Right Click on the routine, and a number of options are available. • Properties – An M-Editor section allows an M-Unit routine to be specified. • Compare With local history allows the current routine to be compared with prior versions (the length of time the routines are saved is determined by a preference (General – Workspace – Local History)) • Replace With allows the current routine to be replaced with an earlier version. 15th VistA Community Meeting
M-EditorProperties for XTMDUTIL 15th VistA Community Meeting
Compare with Local History lets you walk through the changes. You can then use the Replace With to restore a prior version. 15th VistA Community Meeting
If a routine is specified for loading that doesn’t exist on the server, it provides a place to generate the comments for the first two lines (and specify an M-Unit routine for the new routine) 15th VistA Community Meeting
And then opens the new routine in the editor for further editing 15th VistA Community Meeting
There are other functions on the VistA menu available as well • A listing of routines with names beginning with specified characters • A listing of globals with names beginning with specified characters • A listing of global values (both a simple listing and a listing which can be copied and pasted into another account). • These are all non-editable, but can be copied for editing elsewhere. 15th VistA Community Meeting
A request for a Routine Directory listing 15th VistA Community Meeting
Generates the listing below 15th VistA Community Meeting
A request for a global directory listing 15th VistA Community Meeting
And a list of global names beginning with X 15th VistA Community Meeting
A request for a global listing – note the “Setup for copying” check box 15th VistA Community Meeting
A normal global listing 15th VistA Community Meeting
And a global listing setup for copying 15th VistA Community Meeting
Work in progress – In addition to the Red M on Green, there is a bug on an M 15th VistA Community Meeting
Selecting the Option or the M-bug icon displays a dialog box for the code to be processed 15th VistA Community Meeting
An OK on the dialog box causes the Eclipse to change to a debugging perspective for M 15th VistA Community Meeting
The upper left section displays the stack, the current line of code, the last command executed and the next to be executed, it also contains the icons for controlling progress. 15th VistA Community Meeting
The upper right area has panels for breakpoints in the code, variable values, setting watch variables, and their display, and initialization values 15th VistA Community Meeting
The middle and bottom portions contain the code being processed and the console for text display and input 15th VistA Community Meeting
Debugging • Initially, the debugger displays only the line to be processed. • The debugger can be set to step over commands or to run (in the latter case, stops will be made when watch variables change or when a line of code specified as a breakpoint is reached). 15th VistA Community Meeting
The code that will be processed 15th VistA Community Meeting