it.uniroma3.plasm.editors
Class PlasmWordRule

java.lang.Object
  extended byit.uniroma3.plasm.editors.PlasmWordRule
All Implemented Interfaces:
org.eclipse.jface.text.rules.IRule

public class PlasmWordRule
extends java.lang.Object
implements org.eclipse.jface.text.rules.IRule

Just like WordRule, but case insensitive.

Author:
EcT(o)PLaSM Group

Constructor Summary
PlasmWordRule(org.eclipse.jface.text.rules.IWordDetector detector)
          Creates a rule which, with the help of an word detector, will return the token associated with the detected word.
PlasmWordRule(org.eclipse.jface.text.rules.IWordDetector detector, org.eclipse.jface.text.rules.IToken defaultToken)
          Creates a rule which, with the help of an word detector, will return the token associated with the detected word.
 
Method Summary
 void addWord(java.lang.String word, org.eclipse.jface.text.rules.IToken token)
          Adds a word and the token to be returned if it is detected.
 org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner)
          This method uses the PLaSM code detectors to examine any word being digitated to associate it with a particular Token object.
 void setColumnConstraint(int column)
          Sets a column constraint for this rule.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlasmWordRule

public PlasmWordRule(org.eclipse.jface.text.rules.IWordDetector detector)
Creates a rule which, with the help of an word detector, will return the token associated with the detected word. If no token has been associated, the scanner will be rolled back and an undefined token will be returned in order to allow any subsequent rules to analyze the characters.

Parameters:
detector - the word detector to be used by this rule, may not be null
See Also:
addWord(java.lang.String, org.eclipse.jface.text.rules.IToken)

PlasmWordRule

public PlasmWordRule(org.eclipse.jface.text.rules.IWordDetector detector,
                     org.eclipse.jface.text.rules.IToken defaultToken)
Creates a rule which, with the help of an word detector, will return the token associated with the detected word. If no token has been associated, the specified default token will be returned.

Parameters:
detector - the word detector to be used by this rule, may not be null
defaultToken - the default token to be returned on success if nothing else is specified, may not be null
See Also:
addWord(java.lang.String, org.eclipse.jface.text.rules.IToken)
Method Detail

addWord

public void addWord(java.lang.String word,
                    org.eclipse.jface.text.rules.IToken token)
Adds a word and the token to be returned if it is detected.

Parameters:
word - the word this rule will search for, may not be null
token - the token to be returned if the word has been found, may not be null

setColumnConstraint

public void setColumnConstraint(int column)
Sets a column constraint for this rule. If set, the rule's token will only be returned if the pattern is detected starting at the specified column. If the column is smaller then 0, the column constraint is considered removed.

Parameters:
column - the column in which the pattern starts

evaluate

public org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner)
This method uses the PLaSM code detectors to examine any word being digitated to associate it with a particular Token object. Each Token has his caracteristics, one of them is color.

Specified by:
evaluate in interface org.eclipse.jface.text.rules.IRule
See Also:
IRule.evaluate(ICharacterScanner)