org.eclipse.m2m.atl.adt.ui.text
Class AbstractScanner

java.lang.Object
  extended by org.eclipse.jface.text.rules.RuleBasedScanner
      extended by org.eclipse.m2m.atl.adt.ui.text.AbstractScanner
All Implemented Interfaces:
org.eclipse.jface.text.rules.ICharacterScanner, org.eclipse.jface.text.rules.ITokenScanner
Direct Known Subclasses:
AtlCodeScanner

public abstract class AbstractScanner
extends org.eclipse.jface.text.rules.RuleBasedScanner

Its subclasses are only responsible for providing a list of preference keys based on which tokens are generated and to use this tokens to define the rules controlling this scanner.


Field Summary
 
Fields inherited from class org.eclipse.jface.text.rules.RuleBasedScanner
fColumn, fDefaultReturnToken, fDelimiters, fDocument, fOffset, fRangeEnd, fRules, fTokenOffset, UNDEFINED
 
Fields inherited from interface org.eclipse.jface.text.rules.ICharacterScanner
EOF
 
Constructor Summary
AbstractScanner(AtlTextTools texttools)
          Creates an abstract ATL scanner.
 
Method Summary
 void adaptToPreferenceChange(org.eclipse.jface.util.PropertyChangeEvent event)
           
 boolean affectsBehavior(org.eclipse.jface.util.PropertyChangeEvent event)
           
protected abstract  java.util.List createRules()
          Creates the list of rules controlling this scanner.
protected abstract  java.lang.String[] getPropertyNames()
          Returns a list of constants matching the token.
protected  AtlTextTools getTextTools()
           
protected  org.eclipse.jface.text.rules.Token getToken(java.lang.String color)
          Return the token matching the color value.
 void initialize()
          Must be called after the constructor has been called.
 
Methods inherited from class org.eclipse.jface.text.rules.RuleBasedScanner
getColumn, getLegalLineDelimiters, getTokenLength, getTokenOffset, nextToken, read, setDefaultReturnToken, setRange, setRules, unread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractScanner

public AbstractScanner(AtlTextTools texttools)
Creates an abstract ATL scanner. This needs to create firstable the tokens style, and afterwards associate them to their token value.

Method Detail

adaptToPreferenceChange

public void adaptToPreferenceChange(org.eclipse.jface.util.PropertyChangeEvent event)

affectsBehavior

public boolean affectsBehavior(org.eclipse.jface.util.PropertyChangeEvent event)

createRules

protected abstract java.util.List createRules()
Creates the list of rules controlling this scanner.

Returns:
the list of rules

getPropertyNames

protected abstract java.lang.String[] getPropertyNames()
Returns a list of constants matching the token.

Returns:
the list of constants

getTextTools

protected AtlTextTools getTextTools()

getToken

protected org.eclipse.jface.text.rules.Token getToken(java.lang.String color)
Return the token matching the color value.

Parameters:
color - the color name of the key
Returns:
the fetching token

initialize

public final void initialize()
Must be called after the constructor has been called.


Copyright 2007 IBM Corporation and others.
All Rights Reserved.