Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EDT:EGL Editor Introduction"

(Quick fix/Quick Assist)
(Create delegate functions)
Line 66: Line 66:
 
#Choose “Create function ….” ,press “enter” and save the file.<br>[[Image:Quick fix.png|Using quick fix to create callback function]]
 
#Choose “Create function ….” ,press “enter” and save the file.<br>[[Image:Quick fix.png|Using quick fix to create callback function]]
 
==Create delegate functions==
 
==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.
 +
#Take “onclick” event handler of Button as a example.
 +
#Invoke quick fix at the error line.
 +
#Select “Create function ….” ,press “enter” and save the file.<br>[[Image:Delegate2.png|Using quick fix to create delegate function]]
  
 
=Navigation between EGL parts=
 
=Navigation between EGL parts=

Revision as of 06:21, 4 January 2012

Introduction

EGL editor is base on eclipse to provide specialized features for editing EGL code. Associated with the editor is a EGL-specific Outline view, which shows the structure of the active EGL Part. It 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 import)
  • Quick fix
  • Integrated debugging features

In this blog I will introduce some features to improve the EGL development efficiency

  1. Use Content Assist to improve development efficiency
  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 variable, function or finish 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 with the cursor position changing. In the EGL editor press Ctrl + Space or Alt + “/”(Can be configured) on to trigger the content assist.This will open a list of available code completions.

Three types of content assist proposals in EGL

  1. Keyword Proposals:This proposal type only provides EGL Keywords which can be used at the current cursor position.
  2. Reference Proposals:This proposal type provides proposals like variables defined in the context,System type,library,functions which can be used at the current cursor position.
  3. Template Proposals:Template proposal type provide predefined code snippet,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 auto activation checkbox was selected.
  3. Expend Content assist node and select Advanced configure 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 as you want.
    Content Assist Configuration

The content assist dialog

When Content Assist dialog displayed, you can use content assist hotkey to display specific proposal type.
Use Content Assist

How to use content assist

Define a variable

Take defining a checkbox type variable in a RUI Handler as a example.

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

Initial field value for complex types

Take a checkbox type variable as example. In the handler file, currently has a variable defined as following,
acheckbox CheckBox{};

  1. Now we want to initialize the width value of the check box.
  2. Invoke Content assist in “{}”.
  3. Type “w” to filter the result(You can type “i” again to filter result,if you want)
  4. Select “width” and press “enter”,the “width = “ will be inserted into EGL editor.
  5. Invoke Content Assist after “=”, “” will be inserted and you could input the value you want.
    Initialize Complex type

Using template proposals to define part

Template proposals are predefined code templates can be used in EGL language. Users just need to replace some variables with their.
Take defining a Entity subtype Record data type as example:

  1. Move you cursor below the end of last “end” keyword, input “r”,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 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

Navigate between the EGL parts

Vertical ruler

Source folding

Add bookmark & tasks

Back to the top