TextColorer
Keywords: net.sf.colorer.swt.TextColorer,TextColorer class

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 with syntax highlighting 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.
`java.lang.String` | `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.
`java.lang.String` | `getFileType()` Returns currently used file type.
`boolean` | `matchPair()` Moves caret to the position of currently active pair.
`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(java.lang.String 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(java.lang.String name, boolean useBackground)` Changes style/coloring scheme into the specified.
`void` | `stateChanged()`

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 used to be attached to the StyledText widget.

Parameters:
  `pf` - Parsers factory, used to create all coloring text parsers.
  `cm` - Colors 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 java.lang.String 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(java.lang.String typename)

  Selects and installs specified file type.

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

### getFileType

    public java.lang.String getFileType()

  Returns currently used file type.

### setRegionMapper

    public void setRegionMapper(java.lang.String name,
                                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

### 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()

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.