Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.colorer.swt
Class TextColorer

    java.lang.Object
      net.sf.colorer.swt.TextColorer

    public class TextColorer

extends java.lang.Object

StyledText listener implementation with syntax highlighting support using Colorer library. http://colorer.sf.net/

Field Summary
`static int` | `HLS_OUTLINE`
`static int` | `HLS_OUTLINE2`
`static int` | `HLS_XOR`

Constructor Summary
`TextColorer(ParserFactory pf, ColorManager cm)` Common TextColorer creation constructor.

Method Summary
`void` | `addRegionHandler(RegionHandler rh)` Installs specified handler into parse process.
`void` | `attach(StyledText parent)` Installs this highlighter into the specified StyledText object.
`FileType` | `chooseFileType(java.lang.String filename)` Selects and installs coloring style (filetype) according to filename string and current first line of text.
`void` | `detach()` Removes this object from the corresponding StyledText widget.
`BaseEditor` | `getBaseEditor()` Returns current low-level BaseEditor object implementation
`LineRegion` | `getCaretRegion()` Retrieves current LineRegion under caret.
`FileType` | `getFileType()` Returns currently used file type.
`ParserFactory` | `getParserFactory()` Returns currently used ParserFactory object
`int` | `getVisibleEnd()` Returns visible text end line
`int` | `getVisibleStart()` Returns visible text start line
`boolean` | `matchPair()` Moves caret to the position of currently active pair.
`void` | `modifyEvent(int lno)` Tells parser that there were some modifications in source text.
`boolean` | `pairAvailable()` Checks if caret positioned on highlighted pair.
`void` | `removeRegionHandler(RegionHandler rh)` Removes specified handler from the parse process.
`boolean` | `selectContentPair()` Selects an internal part of the currently selected paired content
`boolean` | `selectPair()` Selects a content of the currently positioned pair.
`void` | `setCross(boolean horz, boolean vert)` Specifies visibility of cross at the cursor position.
`void` | `setFileType(FileType typename)` Selects and installs specified file type.
`void` | `setFullBackground(boolean full)` Inlined languages background coloring.
`void` | `setPairsPainter(boolean paint, int style)` Paint paired constructions or not.
`void` | `setRegionMapper(RegionMapper regionMapper, boolean useBackground)` Changes style/coloring scheme into the specified.
`void` | `setRegionMapper(java.lang.String hrdName, boolean useBackground)` Changes style/coloring scheme into the specified.
`void` | `stateChanged()` Informs colorer about visible state change of the editor

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### HLS_XOR

    public static final int HLS_XOR

### HLS_OUTLINE

    public static final int HLS_OUTLINE

### HLS_OUTLINE2

    public static final int HLS_OUTLINE2

Constructor Detail

### TextColorer

    public TextColorer(ParserFactory pf,
                       ColorManager cm)

  Common TextColorer creation constructor. Creates TextColorer object, which is to be attached to the StyledText widget.

  Parameters:
    `pf` - Parser factory, used to create all coloring text parsers.
    `cm` - Color Manager, used to store cached color objects

Method Detail

### attach

    public void attach(StyledText parent)

  Installs this highlighter into the specified StyledText object. Client can manually call detach() method, then wants to destroy this object.

### detach

    public void detach()

  Removes this object from the corresponding StyledText widget. Object can't be used after this call, until another attach. This method is called automatically, when StyledText widget is disposed

### chooseFileType

    public FileType chooseFileType(java.lang.String filename)

  Selects and installs coloring style (filetype) according to filename string and current first line of text.

  Parameters:
    `filename` - File name to be used to autodetect filetype

### setFileType

    public void setFileType(FileType typename)

  Selects and installs specified file type.

  Parameters:
    `typename` - Name or description of HRC filetype.

### getFileType

    public FileType getFileType()

  Returns currently used file type.

### getParserFactory

    public ParserFactory getParserFactory()

  Returns currently used ParserFactory object

### getBaseEditor

    public BaseEditor getBaseEditor()

  Returns current low-level BaseEditor object implementation

### setRegionMapper

    public void setRegionMapper(RegionMapper regionMapper,
                                boolean useBackground)

  Changes style/coloring scheme into the specified.

  Parameters:
    `regionMapper` - External RegionMapper object
    `useBackground` - If true, native HRD background properties would be assigned to colored StyledText.

### setRegionMapper

    public void setRegionMapper(java.lang.String hrdName,
                                boolean useBackground)

  Changes style/coloring scheme into the specified.

  Parameters:
    `name` - Name of color scheme (HRD name).
    `useBackground` - If true, native HRD background properties would be assigned to colored StyledText.

### setFullBackground

    public void setFullBackground(boolean full)

  Inlined languages background coloring.

  Parameters:
    `full` - If true, background color of other language insertions (jsp, php) would be painted till end of line. If false, only text will be painted with marked color.

### setCross

    public void setCross(boolean horz,
                         boolean vert)

  Specifies visibility of cross at the cursor position.

  Parameters:
    `vert` - Not used

### setPairsPainter

    public void setPairsPainter(boolean paint,
                                int style)

  Paint paired constructions or not.

  Parameters:
    `paint` - Paint Matched pairs or not.
    `style` - One of TextColorer.HLS_XOR, TextColorer.HLS_OUTLINE or TextColorer.HLS_OUTLINE2

### pairAvailable

    public boolean pairAvailable()

  Checks if caret positioned on highlighted pair.

### matchPair

    public boolean matchPair()

  Moves caret to the position of currently active pair.

### selectPair

    public boolean selectPair()

  Selects a content of the currently positioned pair.

### selectContentPair

    public boolean selectContentPair()

  Selects an internal part of the currently selected paired content

### getVisibleStart

    public int getVisibleStart()

  Returns visible text start line

### getVisibleEnd

    public int getVisibleEnd()

  Returns visible text end line

### getCaretRegion

    public LineRegion getCaretRegion()

  Retrieves current LineRegion under caret.

  Returns:
    LineRegion currently under Caret

### addRegionHandler

    public void addRegionHandler(RegionHandler rh)

  Installs specified handler into parse process.

### removeRegionHandler

    public void removeRegionHandler(RegionHandler rh)

  Removes specified handler from the parse process.

### stateChanged

    public void stateChanged()

  Informs colorer about visible state change of the editor

### modifyEvent

    public void modifyEvent(int lno)

  Tells parser that there were some modifications in source text. Causes parser to reparse text again

  Parameters:
    `lno` - Modified line number

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003 Cail Lomecb. All Rights Reserved.