Exercise 3.2: Changing default editor settings

Before you begin, you must complete Exercise 3.1: Introducing the editor.

The LPEX Editor has predefined settings, but also has an associated preferences page containing settings that you can modify. The name of the category is LPEX Editor and it appears in the left pane of the Preferences window.
LPEX Editor Preferences

You will change the default settings of LPEX Editor Parsers, Appearance and User Key Actions.

LPEX provides special support for insertion and deletion in column-sensitive languages. When column-sensitive editing is selected, each column is considered as a separate entry space. For example, in an RPG source member, if you are inserting or deleting characters into a string that is in the Factor 2 entry, the Result field entry does not move. The default editor preference is that column-sensitive editing is off. You can switch this support on by going to the workbench preferences window.

Setting column sensitive editing

To set preferences:

  1. Click Window > Preferences from the workbench menu.

    The Preferences window opens.
    Preference window

  2. In the left pane of the Preferences window, expand Remote Systems.
  3. Expand iSeries under Remote Systems.
  4. Select LPEX Editor Parsers under iSeries.

    The right pane allows you to set preferences for this feature.

  5. In the right pane of the Preferences window, select the Column sensitive editing check box.

    When selected, each column is considered as a separate entry space.

  6. Click Apply.

    The Preferences window shows.

    Other interesting preference settings are located under LPEX Editor. Appearance allows you to modify color settings and font used by the Editor.

Changing the editor appearance

  1. In the left pane of the Preferences window, expand LPEX Editor.
  2. Select Appearance under LPEX Editor.
  3. Select formatLine under the Styles list.
  4. Change the Foreground color to dark green.
  5. Change Font to 12.
  6. Change Background color to light green.

    Notice how your changes are reflected in the sample edit view.
    Sample edit view

  7. Select currentLine under the Styles list.

    This option highlights the line that the cursor is on. The option applies to all source files opened in the editor area.

  8. Change the Background color to light yellow.
  9. If you don't like the changes you made, you can click Restore Defaults to return to the original settings.

Modifying the default behavior of the Enter key

To modify the default behavior of the Enter key to split the current line in the source instead of creating a new line:

  1. Expand LPEX Editor if not already expanded then select User Key Actions.
    Set user key actions
  2. Type enter in the Key field.
    Note:
    The Key and Action fields are case sensitive. Make sure that the values typed in the Key and Action fields are exactly as shown above.
  3. Type splitLine in the Action field.
  4. Click Set.

    The Remote System Explorer has a predefined behavior for the Enter key. For the Enter key to use the new split line action you need to change the default Remote System Explorer behavior for the ILE RPG language.
    Set user key actions

  5. Expand Remote Systems, then iSeries if not already expanded and then LPEX Editor Parsers.
  6. Select ILE RPG.
  7. Clear the Repeat previous specification type check box.
  8. Click OK on the Preferences window.

    Return to the Editor window.

Seeing the results of column sensitive editing

Notice that the line the cursor is on is now highlighted in the color you selected for it in the preference setting for highlight current line.
Editor in Insert mode with highlighted line 27

To see what column sensitive editing does:

  1. Move the cursor to line 27, column 10.
  2. Make sure the editor is in Insert mode. If the status area shows Replace press the Insert key.
  3. Press the spacebar 3 times.

    Notice that only the filename is shifted but none of the other columns to the right are effected.
    Inserted blanks in file name, none of the other columns has been shifted

  4. Press the Backspace 3 times.

    Once again the filename is shifted but no other columns are effected.

Seeing the results of splitLine

To see what splitLine does:

  1. Place the cursor somewhere on a line and press Enter.

    The text to the right of the cursor is moved to the next line.

You have changed the default editor settings and now you are ready to begin Exercise 3.3: Entering SEU commands.