The EGL editor is designed to help you write EGL source
code and includes additional functions for writing code for Rich UI
applications.
You can use the EGL editor—or,
in relation to Rich UI, the Source tab
of the EGL editor—to format code, highlight invalid syntax, and gain
assistance with keystrokes. For details that are specific to Rich
UI, see “EGL editor for Rich UI.”
The basics
To
open an EGL source file in
the EGL editor, in the Project Explorer view, either double-click
the file or right-click it and then select .
The
editor uses many of the same functions as the other text and code
editors in the workbench:
- Cut, copy, and paste code with commands
in the Edit menu.
- Save the current
file by either pressing CTRL+S, clicking the Save button
on the toolbar, or clicking .
- Generate the current
file by either pressing CTRL+G, or right-clicking
the file in the Project Explorer view and then clicking Generate.
- Undo your most recent change by either pressing CTRL+Z, or clicking .
- Switch between open files by clicking the tabs at the top of the
editor.
- Locate the file in a different view by clicking and then click either Project Explorer, Outline,
or Navigator.
- To indent or reverse
the indent of code, select one or more lines,
right-click, and click either Shift Right or Shift
Left.
- To comment or uncomment one or more lines
of code, select one
or more lines, right-click, and then click either Comment or Uncomment.
To use some functions of the editor, you must select one
or more lines of code (sometimes referred to as a
block of
code). You can select code in any of these ways:
- To select
one or more lines of code, click and drag the mouse
over the code.
- To select one word, double-click the word.
- To select a code block, put the cursor at the beginning of the
code block, hold the Shift key, and use the arrow keys to move the
cursor to the end of the block. You can also double-click at the beginning
or end of a code block.
- To select the entire file, Press Ctrl+A.
You can control how EGL code is displayed in the editor;
for more information, see “Setting preferences for EGL text.”
Writing code faster
To decrease
code development time, use content assist. Content
assist searches for valid keywords, variables, or part names that
begin with the first few characters that you type and the matching
code. To activate content assist, press CTRL+Space and choose a keyword,
variable, part, or function from the list of options. To filter the
list, you can type the first few characters of a keyword, part, or
variable. For more information, see “Writing code by using content
assist.”
Content assist can also insert larger code templates into
your code, such as a framework for a part. For more information, see
“Code templates.”
With the editor, you can also use wizards
to generate EGL code
into the file you are editing. For example, you can use the DataItem
part source assistant to set the properties for a DataItem part. For
more information, see ”Editing DataItem parts with the source assistant.”
Getting help
The editor provides dynamic
help for most EGL keywords. To activate dynamic help, highlight an
EGL keyword, such as package, and press
F1. You can also press F1 to open dynamic help when you are in most
EGL-related wizards and windows.
Organizing
code
You can use the EGL editor
to organize your
import statements. To organize
import statements,
right-click in the editor and then click
Organize Imports.
The editor changes your
import statements
in the following ways:
- It arranges the import statements
in
the order that is specified on the Organize Imports preference
page. For information, see “Setting preferences for organizing import
statements in the EGL editor.”
- It removes any unused import statements.
- It combines multiple import statements
to the same package into a single import statement with a wildcard
character, based on the settings in the preference page.
- It
attempts to add import statements
for any parts that are used in the file but that are not in scope.
With the editor, you can also fold code.
Folding a block of code hides that code temporarily, so that you can
see only the parts of the source file that you want to see. To fold
a block of code, click the minus icon on the left side of the editor.
To fold lines of code, select the lines, right-click, and then click Fold
Text. To restore the code, click the minus icon again.
Folding does not change the behavior of your code.
Depending
on your folding preference settings, certain blocks of code might
be folded automatically when you open a source file in the editor.
For more information, see “Setting preferences for folding in the
EGL editor.”
Customizing
the EGL editor
The
formatting preferences affect how the code is formatted in the editor,
including what characters and how many characters to use for indentation,
whether to use upper or lower case for keywords, and how much white
space to include in the source code.
You can create one or more
EGL editor profiles by using the EGL Editor Formatter preference.
In EGL, two formatting profiles are defined:
- EGL [build in]
- VA Gen [build in]
You cannot change the formatting preferences
within these two
profiles or remove these profiles. Any profile that you create is
added to the list of available profiles. You can change or remove
any profile that you create.
For information about defining
editor profile preferences, see “Setting preferences for formatting
in the EGL editor.”