Comparing source files

To compare a file with its previous version stored in the local history, follow these steps:

 

  1. Make sure that "helloworld" project created according to the instructions of this guide is present in LyciaStudio.

  2. Right-click the "hello" source file in the 4GL Project view and select the Compare With -> Local History option:

 

 

The Compare With option is also available from the context menu of the editor in which this file is opened.

  1. The "History" view will be opened. The toolbar of the "History" view contains several tools that allow you to manage the local history:

 

 

a.     When the Link Description: 3.JPG button is pressed the "History" view displays the history of the source file currently opened in the editor area.

b.     When the Group Description: 3.JPG button is pressed, the revisions in the "History" view are grouped by date:

 

c.     If the Compare ModeDescription: 3.JPG button is enabled, double-clicking a revision will open a Compare editor. When it is disabled, the revision will be opened in a separate source text editor. Do not disable this button for this demonstration purpose.

  1. Double-click the previous revision of the source file in the "History" view.

  1. The Compare editor will be opened in the editor area:

 

 

  1. You can see from above that the "Hi" character string differs from the "Hello" character string, as we have replaced "Hello" with "Hi" in the "Search" section of this chapter. The differences are marked with grey color and the lines in which the differences are spotted are linked to each other.

  2. The Compare editor toolbar contains tools which are used to manage changes and differences in the compared files. The tools differ depending on whether a file is compared with the local history or with another source file.

a.     Description: http://help.eclipse.org/galileo/topic/org.eclipse.platform.doc.user/images/copy_l_co.gif button copies all the non-conflicting changes from the right pane into the left pane.

b.     Description: http://help.eclipse.org/galileo/topic/org.eclipse.platform.doc.user/images/copycont_l_co.gif button merges changes in two files by copying the highlighted change in the right pane into the highlighted fragment on the left. This will overwrite the highlighted fragment in the left pane.

c.     Description: http://help.eclipse.org/galileo/topic/org.eclipse.platform.doc.user/images/next_diff_nav.gif and Description: http://help.eclipse.org/galileo/topic/org.eclipse.platform.doc.user/images/prev_diff_nav.gif buttons navigate among the lines that contain differences found between the compared resources.

d.     Description: http://help.eclipse.org/galileo/topic/org.eclipse.platform.doc.user/images/next_change_nav.gif and Description: http://help.eclipse.org/galileo/topic/org.eclipse.platform.doc.user/images/prev_change_nav.gif buttons navigate among the individual changes found between the compared resources.

To compare two source files, follow these steps:
  1. Make sure that "helloworld" project you created according to the instructions of this guide is present in LyciaStudio.

  2. Create a second 4GL source file "hello2" within the "helloworld" project and copy the following code into this file:

 

FUNCTION hello() 

   DISPLAY "Hi World" AT 2,2

   SLEEP 3

END FUNCTION

 

  1. Save the file.

  2. Select both "hello" and "hello2" files in the 4GL Project view, right-click one of the selected files and choose the Compare With -> Each Other option:

 

 

  1. The Compare editor will be opened displaying the both files:

 

 

  1. The Compare editor toolbar will contain two new options which are not available when a file is compared to its history:

 

a.     The Description: http://help.eclipse.org/galileo/topic/org.eclipse.platform.doc.user/images/copy_r_co.gif button copies all the non-conflicting changes from the left pane into the right pane.

b.     The Description: http://help.eclipse.org/galileo/topic/org.eclipse.platform.doc.user/images/copycont_r_co.gif button merges changes in two files by copying the highlighted change in the left pane into the highlighted fragment on the right. This will overwrite the highlighted fragment in the right pane.

When two graphical form files are compared, they are transformed into special text code, because only text can be compared by means of the Compare editor. However, this code is not the 4GL code, thus it is advisable to compare form files in .per formats.