Package org.eclipse.jface.text.rules

Examples of org.eclipse.jface.text.rules.Token


    // Add generic whitespace rule.
    rules[0] = new WhitespaceRule(new WhitespaceDetector());

    setRules(rules);
        setDefaultReturnToken(new Token(new TextAttribute(manager.getTextColor())));
  }
View Full Code Here


import org.eclipse.jface.text.rules.WhitespaceRule;

public class SentenceScanner extends RuleBasedScanner {

  public SentenceScanner(ColorManager manager) {
    IToken string = new Token(new TextAttribute(manager.getStringColor()));
        final Token terminals = new Token(new TextAttribute(manager.getTerminalsColor()));
        Token template = new Token(new TextAttribute(manager.getTemplateColor()));
        Token keyword = new Token(new TextAttribute(manager.getKeywordsColor()));
        Token others = new Token(new TextAttribute(manager.getOtherColor()));

        final List<IRule> rules = new ArrayList<IRule>();

    // Add rule for double quotes
    rules.add(new SingleLineRule("\"", "\"", string, '\\'));
View Full Code Here

  public final static String SENTENCE = "__sentence";

  public TemplatesPartitionScanner() {

    final IToken tag = new Token(SENTENCE);

    final List<PatternRule> rules = new ArrayList<PatternRule>();

    rules.add(new MultiLineRule(TemplateTokens.LTP_OPEN, TemplateTokens.LTP_CLOSE, tag));
View Full Code Here

import org.eclipse.jface.text.rules.WhitespaceRule;

public class XMLTagScanner extends RuleBasedScanner {

    public XMLTagScanner(ColorManager manager) {
        IToken string = new Token(new TextAttribute(manager.getColor(IXMLColorConstants.STRING)));

        IRule[] rules = new IRule[3];

        // Add rule for double quotes
        rules[0] = new SingleLineRule("\"", "\"", string, '\\');
View Full Code Here

public class RutaPartitionScanner extends RuleBasedPartitionScanner {

  public RutaPartitionScanner() {
    super();

    IToken string = new Token(RutaPartitions.RUTA_STRING);
    IToken comment = new Token(RutaPartitions.RUTA_COMMENT);

    List/* < IPredicateRule > */rules = new ArrayList/* <IPredicateRule> */();

    rules.add(new EndOfLineRule("//", comment));

View Full Code Here

  public ColorProvider(IPreferenceStore store) {
    this.store = store;
  }
 
  public IToken getToken(String prefKey){
     Token token = (Token) tokenTable.get(prefKey);
     if (token == null){
      String colorName = store.getString(prefKey);
      RGB rgb = StringConverter.asRGB(colorName);
      token = new Token(new TextAttribute(getColor(rgb)));
      tokenTable.put(prefKey, token);
     }
     return token;
  }
View Full Code Here

    }
    return color;
  }

  public boolean affectsTextPresentation(PropertyChangeEvent event){
     Token token = (Token) tokenTable.get(event.getProperty());
     return (token != null);
  }
View Full Code Here

     return (token != null);
  }

  public void handlePreferenceStoreChanged(PropertyChangeEvent event){
     String prefKey = event.getProperty();
     Token token = (Token) tokenTable.get(prefKey);
     if (token != null){
      String colorName = store.getString(prefKey);
      RGB rgb = StringConverter.asRGB(colorName);
      token.setData(new TextAttribute(getColor(rgb)));
     }
  }
View Full Code Here

* @author Naoki Takezoe
*/
public class DTDPartitionScanner extends RuleBasedPartitionScanner {
 
  public DTDPartitionScanner(){
    IToken htmlComment = new Token(HTMLPartitionScanner.HTML_COMMENT);
    IToken htmlTag = new Token(HTMLPartitionScanner.HTML_TAG);
//    IToken defaultToken = new Token(IDocument.DEFAULT_CONTENT_TYPE);
   
    List rules = new ArrayList();
   
    rules.add(new MultiLineRule("<!--", "-->", htmlComment));
View Full Code Here

  public final static String JAVASCRIPT     = "__html_javascript";
  public final static String HTML_CSS       = "__html_css";
 
  public HTMLPartitionScanner() {

    IToken htmlComment   = new Token(HTML_COMMENT);
    IToken htmlTag       = new Token(HTML_TAG);
    IToken htmlScript    = new Token(HTML_SCRIPT);
    IToken htmlDoctype   = new Token(HTML_DOCTYPE);
    IToken htmlDirective = new Token(HTML_DIRECTIVE);
    IToken javaScript    = new Token(JAVASCRIPT);
    IToken htmlCss       = new Token(HTML_CSS);

    List rules = new ArrayList();

    rules.add(new MultiLineRule("<!--", "-->", htmlComment));
    rules.add(new MultiLineRule("<%--", "--%>", htmlComment));
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.rules.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.