Editor Bridge
Version: 1.0
Author: Miloslav Metelka, Sun Microsystems/NetBeans
Document History:
available in CVS
Content
This document describes the editor bridge that allows
the lexers generated by lexer module framework
to provide syntax coloring for the editor.
Modules
There are two submodules of the lexer module related to editor bridge:
- editorbridge located under lexer/editorbridge contains the actual editor bridge implementation.
- calc located under lexer/editorbridge/calc contains example of a syntax coloring for a simple calculator.
Compatibility
The Calc example syntax coloring was tested in NetBeans 3.3.2, 3.4 and 3.5. It appears to work on both JDK1.3 and JDK1.4.
Installation
The installed modules include:
- lexer.jar - Lexer Module
- lexer-editorbridge.jar - Editor Bridge
- lexer-editorbridge-calc.jar - Calc Example
It's necessary to download the above modules from the
Lexer module's download area
or use Alpha autoupdate site to download and install the modules.
There is a data loader that recognizes files with .calc extension.
There is currently no template so it's necessary to create e.g. a.calc file
manually. The file should show up with a html-like icon and when editor is invoked
the text should be colorized.
Syntax Coloring
The editorbridge uses the org.netbeans.modules.lexer.editorbridge.LexerLayer
to do the actual syntax coloring.
The lexer layer is backed by org.netbeans.modules.lexer.editorbridge.TokenRootElement
which contains the token elements produced and updated by the corresponding lexer as children.
The sample assignment of the fonts and colors is done in
org.netbeans.modules.lexer.editorbridge.calc.CalcKit.
Open Issues
Add a template so that it's easier to create .calc files.
Add editor options for the calc mime-type.