Skip to main content
Jump to: navigation, search

Difference between revisions of "EDT:EGL Editor Introduction"

m (Initial field value for complex types)
m (Initialie field value for complex types)
Line 45: Line 45:
#The content assist lists all proposals. You can type characters to filter the result.<br>[[Image:Definevar.png|Define a variable]]
#The content assist lists all proposals. You can type characters to filter the result.<br>[[Image:Definevar.png|Define a variable]]
=== Initialie field value for complex types ===
=== Initialize a field value for complex types ===
In the handler file, a variable defined as follows:
In the handler file, a variable defined as follows:

Revision as of 14:20, 20 February 2012


The EGL editor provides specialized features for editing EGL code in Eclipse. Associated with the editor is a EGL-specific Outline view, which shows the structure of the active EGL Part. The Outline view is updated as the user edits the EGL file. The EGL editor includes the following features:

  • Syntax highlighting
  • Content/code assist
  • Code formatting
  • Import assistance (Organize imports)
  • Quick fix
  • Integrated debugging features

This article introduces some features to improve the EGL development efficiency.

  1. Content Assist
  2. Quick fix/Quick Assist
  3. Navigation between EGL parts
  4. Vertical ruler

Use Content Assist to improve development efficiency

Content assist helps you to quickly define a variable, function or complete a line of code in the EGL editor. The content assist is context sensitive, which means that the proposals listed in the dialog is different depending on the cursor position. In the EGL editor, press Ctrl + Space or Alt + “/”(depending on your configuration) to trigger the content assist which lists possible code completion options.

Three types of content assist proposals in EGL

  1. Keyword Proposals:This type only provides EGL Keywords.
  2. Reference Proposals:This type provides proposals such as variables defined in the context, System type, library, functions.
  3. Template Proposals:This type provides predefined code snippets, like function definition code, externaltype definition code, etc.

How to configure content assist

  1. Open configuration dialog Window>Preferences>EGL>Editor>Content Assist
  2. Make sure the "Enable auto activation" checkbox is selected.
  3. Expand Content assist node and select the Advanced page.
  4. Choose those Proposal kinds in your default proposal list. (The first proposal list when content assist was invoked.)
  5. Configure the order of proposal kinds you want.
    Content Assist Configuration

The content assist dialog

When the Content Assist dialog is displayed, you can use the content assist hot key to display a specific proposal type.
Use Content Assist

How to use content assist

Define a variable

Example: Defining a checkbox type variable in a RUI Handler.

  1. Type the variable name you want.
  2. Invoke Content assist.
  3. The content assist lists all proposals. You can type characters to filter the result.
    Define a variable

Initialize a field value for complex types

In the handler file, a variable defined as follows:

acheckbox CheckBox{};

Now we want to initialize the width value of the check box.

  1. Invoke Content assist within “{}”.
  2. Type “w” to filter the result. (You can type “i” again to filter result, if you want.)
  3. Select “width” and press Enter.  The “width = “ will be inserted into EGL editor.
  4. Invoke Content Assist after “=”, “” will be inserted and you could input the value you want.
    Initialize Complex type

Using template proposals to define a part

Template proposals are predefined code templates can be used in EGL language. Templates allow you to replace some variables with your own.
Example: Defining a Entity subtype Record data type

  1. Move the cursor below the end of last end keyword, input “r”, and invoke Content Assist.
  2. Select “record-entity record” and press Enter.
  3. The cursor will auto focus on the “recordName”. Input the variable name.
    Use Content Assist to define entity type record

Using template to define a function

  1. Put the cursor before the last end keyword.
  2. Input a “f”, and invoke Content assist.
  3. Choose “function with parameters and...” and press Enter. The function prototype will be generated for you.

    Using Template to define function

Quick fix/Quick Assist

The EGL editor offers corrections to problems found while typing and after compiling. To show that correction proposals are available for a problem. Default hotkey for Quick fix/Quick assist is Ctrl + 1.

Create callback functions

  1. Write the function name you want after “returning to”,in the example is “aReturnFunction”.
  2. Invoke quick fix by press Ctrl + 1
  3. Choose “Create function ….” ,press “enter” and save the file.
    Using quick fix to create callback function

Create delegate functions

Sometimes when you do not know the definition of a delegate, and you need to create instance of the delegate(create a function) .In this time, quick fix could create a prototype for you.

  1. Take “onclick” event handler of Button as a example.
  2. Invoke quick fix at the error line.
  3. Select “Create function ….” ,press “enter” and save the file.
    Using quick fix to create delegate function

Navigation between EGL parts

Open part dialog

  1. Open the Open Part dialog by pressing Ctrl+Shift+F3, choosing Navigate > Open Part...
  2. Press the Arrow Down key to select CheckBox
  3. Press Enter to open the Part in the EGL editor.
    Open part dialog

Navigate between the EGL parts

On the Line 6 of the aHandler part declaration, select the aService variable. Click Open on Selection from the context menu (or press F3).
Open on selection

The aService Part opens in the editor area and is also represented in the Outline view. Note: This command also works on functions and fields.

After this action, cursor will jump to the definition of aService.
Open on selection

Vertical ruler

The left side of EGL editor is vertical ruler. Right click on the vertical ruler,a pop-up context menu will show. Through this menu lists, you could manager the display structure of source code,show line number,add/delete bookmark,task etc.
Vertical ruler

Source folding

Folding function is used to enable users quickly organize the source code display structure.

  • You can right click vertical ruler Folding>Togge Folding or
  • Press Ctrol + /(Number pad)

To enable/disable folding function.

Add bookmark & tasks

The Workbench allows you to create bookmarks in files that you edit so that you can quickly reopen those files from the Bookmarks view

  1. With the file open in an editor, right-click in the gray border at the left of the editor area, next to the line of code or text that you want to bookmark.
  2. Select Add Bookmark from the pop-up menu.
  3. Notice that an icon for the bookmark now appears in the left border of the editor area. A record ine is also added to the Bookmarks view.)

You can add/delete/manipulate task with the same way in EGL editor and task view.

Back to the top