VRML Editor - User Manual

This document aims to describe the Mobile Widgets SDK VRML Editor Plug-in.
This plug-in, once integrated in the Eclipse platform, provides a complete VRML editor.
The following functionalities are embedded in this plug-in:

All these functionalities will be detailed in the present document.

The functionalities provided by the editor apply to " .wrl " files in " src " folder. They are detailed below.

Creation wizard

Each file with the " .wrl " extension can be open with the VRML Editor plug-in.
When the plug-in is installed, these files are represented by the following icon: vrml file icon

A " .wrl " file can be created with the creation wizard included in the VRML Editor plug-in.

Launch " New Other " from the Toolbar

Widgets SKD

In top menu bar, 2 possibilities:

Or

Launch " New Other " from the New Project... menu

Widgets SKD

In top menu bar, 2 possibilities:

Or

new file wizard

" New - Select a wizard " dialog box is opened.
Select " VRML File " under " General " folder.
Select " Next > " button to continue.


set file name

" New VRML File - Create a new VRML File " dialog box is opened.
Choose a location by entering or Selecting the " parent folder " and " src " folder.
Enter a name for this file in " File name: " textfield. (the extension does not need to be specified)
Select " Finish " button to open the new file " .wrl ".


newly file created

The newly created file (here " new.wrl ") is displayed and contains a VRML header.


Note:
A " .wrl " file can also be created with a simple File creation wizard.
But in that case, the extension " .wrl " will have to be specified in " File name: " textfield.
The header will not be present.


Widgets SKD

" New - Select a wizard " dialog box is opened.
Select " File " under " General " folder.
Select " Next > " button to continue.

set file name

" New VRML File - Creates a new VRML File " dialog box is opened.
Choose a location by entering or Selecting the " parent folder " and " src " folder.
Enter a name with the extension " .wrl " for this file in " File name: " textfield.
Select " Finish " button to open the new file " .wrl ".


newly file created

The newly created file (here " empty.wrl ") is displayed without contain a VRML header.
However, it is a valid " .wrl " file that has all the features of the VRML Editor.


Syntax highlighting

The VRML editor automatically provides a syntax highlighting, as shown below:

syntax highlighting

The syntax highlighting applies for VRML and JavaScript code.


Refactoring

Select a VRML node name or a JavaScript function name.
Then

Or

Refactor Rename

" Refactor - Enter new name: " dialog box is opened.
The current selection is displayed to the " New name: " textfield.


Refactor Rename

If you enter a new name in the " New name: " textfield (here image for example) and press " Finish " button, all the occurrences of the item are replaced by this new name.
(For example, here all the occurrences myImage are replaced by image).

occurrences replaced


Braces collapse

The code blocks delimited by braces. " { " or " } " are signalled in the margin by a minus Refactor Rename sign (marked in blue).

not collapsed


When one of these minus signs is clicked, the corresponding block is collapsed.
A plus Refactor Rename sign (marked in blue) appears in the margin, allowing expanding the block.

collapsed


Automatic selection of areas

The areas delimited by braces " {  } " or square brackets " [   ] " can be automatically selected.
To have automatic selection of areas:

or

Automatic selection


Brackets highlighting

When the cursor is positioned just after a brace " { " or " } " or a square bracket " [ " or " ] " (opening or closing), the associated bracket is highlighted with a little pink rectangle Refactor Rename (marked in blue).

Brackets highlighting


Nodes and functions occurrences highlighting

When a node or a function name is selected in the current " .wrl " file (here " main.wrl "):

occurrences highlighting


Code formatting

Line automatic formatting

occurrences highlighting

In top menu bar, select " Window " then " Preferences " then " VRML Editor ".

occurrences highlighting

" Preferences - VRML Editor " dialog box is opened.
The line automatic formatting can be configured in the VRML Editor preferences.
By default, the option " Line auto formatting when typing } activated " is not checked.

occurrences highlighting

To activate this option, check " Line auto formatting when typing } activated ".
Select " Apply " button and select " OK " button to save your preferences.

If you activate it, when a closing brace " } " is typed, the current line is automatically formatted.
For example, the following line is typed:

line not formatted

When a closing brace is added at the end of the line, the line is automatically formatted:

line formatted


Code blocks formatting

Code formatting can also be applied to code blocks.

For example, a block of code to format:

block not formatted

Select the code to format.

block not formatted

Then, 2 possibilities:

Or

block formatted

The block of code is now well-formatted:

Note:
If no code is selected, the whole document is formatted.


Comment/Uncomment

The VRML and JavaScript comment characters are different.
But there is only one key binding to comment/uncomment code: (" Ctrl + Shift + C ") shortcut.


Comment/Uncomment in VRML

Comment in VRML

The comment character in VRML language is " Refactor Rename ".
To comment some code:

Or

select to comment VRML

When the code is selected, using (" Ctrl + Shift + C ") shorcut.

comment VRML

The selected lines are commented.


Uncomment in VRML

To uncomment some code commented:

Or When the code is selected, using (" Ctrl + Shift + C ") shorcut.

uncomment VRML

The selected lines are uncommented : the comment character " Refactor Rename " is now not displayed.


Comment/Uncomment in JavaScript

The comment character in JavaScript is " Refactor Rename ".

To comment or uncomment some Javascript code:

Or When the code is selected, using (" Ctrl + Shift + C ") shorcut.

uncomment VRML

The selected lines are commented or uncommented.


Spell checking

When the Eclipse spell checking is activated, the errors present in comments (VRML and JavaScript) are underlined.
spell checking on

If the error is fixed, the editor is updated and the word is no longer underlined.
spell checking off


occurrences highlighting

In top menu bar, select " Window " then " Preferences " then " General " then " Editors " then " Text Editors " then " Spelling ".

occurrences highlighting

" Preferences - Spelling " dialog box is opened.

occurrences highlighting

To activate spell checking, check the option " Enable spell checking ".
Keep all options checked.
Select " Apply " button and select " OK " button to save your preferences.


Outline view

Outline

The VRML Editor provides an outline view which shows:

When the VRML nodes or the JavaScript functions are not explicitly defined in a Proto, they are displayed under a Proto object whose name is the same as the file name (" .wrl ").

This outline view allows reaching easily the Protos, the VRML objects (node definition) and the JavaScript functions, just by clicking on their names.

By default, the items (Protos, VRML objects (node definition) and JavaScript functions) are displayed by order of appearance in the file.
They can be sorted in alphabetical order with the Outline hidden button on the outline menu bar.

Outline sorted

Items can also be hidden by type (VRML objects (node definition) or JavaScript function).

Completion

The VRML Editor provides completion for VRML attributes proposition, VRML objects (node definition) and for JavaScript functions.
Completion called by (" Ctrl + Space ") shortcut.

VRML attributes proposition

In a VRML object declaration, the completion can be called on order to display the arguments of the object.
Left click after the object and use (" Ctrl + Space ") shortcut to display the arguments applied to the object.

VRML attributes proposition


VRML Objects (node definition)

When a VRML object is defined in the current " .wrl " file (by using " DEF "), completion is activated for this object.

To use completion, write the object's name (here " SCRIPT " for example) followed by a dot.
Left click after the dot and use (" Ctrl + Space ") shortcut to display the list of available propositions.

VRML Objects


JavaScript functions

The functions available in JavaScript can be displayed and selected the same way, with an additional help (in the yellow box).

To use completion, write the object's name (here " SCRIPT " for example) followed by a dot.
Left click after the dot and use (" Ctrl + Space ") shortcut to display the list of available propositions.

JavaScript functions


Moreover, completion proposals also appear when no word has been typed within a function:

JavaScript functions typed


When this list is displayed, typing one or several letters will reduce it to the appropriate entries:

JavaScript functions appropriate


Function template

When the completion is called within a script but outside JavaScript functions, a template function is created with a generic name " function name() ":

Function template

Important:
A first fonction must be existed before the space where the completion of function template is launched.
Like " function initialize() {} " for example.

Code and comments auto-insertion

The VRML Editor provides some code and comments auto-insertion functionalities.

Code auto-insertion

The word " Script " followed by the " Enter " key clicked is recognized by the editor. The following code block is inserted:
Code auto-insertion

Comments auto-insertion

Comments are inserted automatically in three cases (before a root node, before a VRML node and before a JavaScript function):

Generate field SFNodes within scripts

The VRML Editor offers the possibility to automatically generate the field SFNode ( Single Field Node ) line for each node present in the document.
This option is very practical in cases of huge VRML files.
It avoids the user to search through all the files:

For example, the MY_TIMER node has not been used in the SCRIPT script:

Generate field


Generate field contextual

To access to Generate field SFNodes, 2 possibilities:

Or

Generate field contextual

" Generate field SFNodes " dialog box is opened.
This wizard contains only the nodes that have not been used in scripts.
Use the checkboxes to indicate which SFNode fields have to be generated.
Select " Finish " button.

For this example, " MY_TIMER " is checked.

Generate field contextual


Generate field contextual

The selected nodes are added at the beginning of the script.
The field name is the node name in lowercase (myTimer).
Underscores are removed and the letter that follows them is in uppercase.


Preferences

By default, the character used for auto-indentation (when the text is formatted) is two spaces.
This character can be modified in the Preferences menu.

occurrences highlighting

In top menu bar, select " Window " then " Preferences " then " VRML Editor ".

occurrences highlighting

" Preferences - VRML Editor " dialog box is opened.
Choose your " Auto indentation character " by " 2 spaces ", " 4 spaces " or " Tab character ".

The VRML Editor Preferences page also allows enabling or disabling the line auto formatting.