Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.port80.eclipse.xml.editors
Class XMLTagRule  view XMLTagRule download XMLTagRule.java

java.lang.Object
  extended bycom.port80.eclipse.xml.editors.XMLTagRule
All Implemented Interfaces:
org.eclipse.jface.text.rules.IPredicateRule, org.eclipse.jface.text.rules.IRule

public class XMLTagRule
extends java.lang.Object
implements org.eclipse.jface.text.rules.IPredicateRule

A modification of the PatternRule that skip over quoted strings.


Field Summary
protected static java.lang.String DOCTYPE
           
protected static char END
           
protected  boolean fBreaksOnEOL
          Indicates whether end of line termines the pattern
protected  int fColumn
          The pattern's column constrain
protected  char fEscapeCharacter
          The pattern's escape character
protected  org.eclipse.jface.text.rules.IToken fToken
          The token to be returned on success
protected  boolean isDocType
           
protected static char START
           
protected static int UNDEFINED
           
 
Constructor Summary
XMLTagRule(org.eclipse.jface.text.rules.IToken token, char escapeCharacter, boolean breaksOnEOL)
          A specialized pattern rule to detected tag partition.
 
Method Summary
protected  org.eclipse.jface.text.rules.IToken doEvaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner)
          Evaluates this rules without considering any column constraints.
protected  org.eclipse.jface.text.rules.IToken doEvaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner, boolean resume)
          Evaluates this rules without considering any column constraints.
protected  boolean endSequenceDetected(org.eclipse.jface.text.rules.ICharacterScanner scanner)
          Returns whether the end sequence was detected.
 org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner)
          Evaluates the rule by examining the characters available from the provided character scanner.
 org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner, boolean resume)
          Evaluates the rule by examining the characters available from the provided character scanner.
 org.eclipse.jface.text.rules.IToken getSuccessToken()
          Returns the success token of this predicate rule.
private  boolean isDocType(org.eclipse.jface.text.rules.ICharacterScanner scanner)
           
protected  boolean sequenceDetected(org.eclipse.jface.text.rules.ICharacterScanner scanner, char[] sequence, boolean eofAllowed)
          Returns whether the next characters to be read by the character scanner are an exact match with the given sequence.
 void setColumnConstraint(int column)
          Sets a column constraint for this rule.
private  boolean skipQuoted(org.eclipse.jface.text.rules.ICharacterScanner scanner, int delim)
          Skip quoted string until given delim is detected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDEFINED

protected static final int UNDEFINED
See Also:
Constant Field Values

DOCTYPE

protected static final java.lang.String DOCTYPE
See Also:
Constant Field Values

START

protected static final char START
See Also:
Constant Field Values

END

protected static final char END
See Also:
Constant Field Values

fToken

protected org.eclipse.jface.text.rules.IToken fToken
The token to be returned on success


fColumn

protected int fColumn
The pattern's column constrain


fEscapeCharacter

protected char fEscapeCharacter
The pattern's escape character


fBreaksOnEOL

protected boolean fBreaksOnEOL
Indicates whether end of line termines the pattern


isDocType

protected boolean isDocType
Constructor Detail

XMLTagRule

public XMLTagRule(org.eclipse.jface.text.rules.IToken token,
                  char escapeCharacter,
                  boolean breaksOnEOL)
A specialized pattern rule to detected tag partition.

Method Detail

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.


evaluate

public org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner)
Description copied from interface: org.eclipse.jface.text.rules.IRule
Evaluates the rule by examining the characters available from the provided character scanner. The token returned by this rule returns true when calling isUndefined, if the text the rule investigated does not match the rule's requirements.

Specified by:
evaluate in interface org.eclipse.jface.text.rules.IRule

evaluate

public org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner,
                                                    boolean resume)
Description copied from interface: org.eclipse.jface.text.rules.IPredicateRule
Evaluates the rule by examining the characters available from the provided character scanner. The token returned by this rule returns true when calling isUndefined, if the text the rule investigated does not match the rule's requirements. Otherwise, this method returns this rule's success token. If this rules relies on a text pattern comprising a opening and a closing character sequence this method can also be called when the scanner is positioned already between the opening and the closing sequence. In this case, resume must be set to true.

Specified by:
evaluate in interface org.eclipse.jface.text.rules.IPredicateRule

getSuccessToken

public org.eclipse.jface.text.rules.IToken getSuccessToken()
Description copied from interface: org.eclipse.jface.text.rules.IPredicateRule
Returns the success token of this predicate rule.

Specified by:
getSuccessToken in interface org.eclipse.jface.text.rules.IPredicateRule

doEvaluate

protected org.eclipse.jface.text.rules.IToken doEvaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner)
Evaluates this rules without considering any column constraints.


doEvaluate

protected org.eclipse.jface.text.rules.IToken doEvaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner,
                                                         boolean resume)
Evaluates this rules without considering any column constraints. Resumes detection, i.e. look sonly for the end sequence required by this rule if the resume flag is set.

Since:
2.0

sequenceDetected

protected boolean sequenceDetected(org.eclipse.jface.text.rules.ICharacterScanner scanner,
                                   char[] sequence,
                                   boolean eofAllowed)
Returns whether the next characters to be read by the character scanner are an exact match with the given sequence. No escape characters are allowed within the sequence. If specified the sequence is considered to be found when reading the EOF character.


endSequenceDetected

protected boolean endSequenceDetected(org.eclipse.jface.text.rules.ICharacterScanner scanner)
Returns whether the end sequence was detected. As the pattern can be considered ended by a line delimiter, the result of this method is true if the rule breaks on the end of the line, or if the EOF character is read.


skipQuoted

private boolean skipQuoted(org.eclipse.jface.text.rules.ICharacterScanner scanner,
                           int delim)
Skip quoted string until given delim is detected.


isDocType

private boolean isDocType(org.eclipse.jface.text.rules.ICharacterScanner scanner)