Package tool.editors.text

Source Code of tool.editors.text.ToolPartitionScanner

package tool.editors.text;

import java.util.ArrayList;

import org.eclipse.jface.text.rules.IPredicateRule;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.MultiLineRule;
import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
import org.eclipse.jface.text.rules.Token;

import tool.editors.rules.DoubleHyphenCommentRule;
import tool.editors.rules.DoubleSlashCommentRule;
import tool.editors.rules.MultiLineCommentRule;
import tool.editors.rules.MultiLineWordPatternRule;

public class ToolPartitionScanner extends RuleBasedPartitionScanner {

  public final static String TOOL_COMMENT = "__tool_comment";
  public final static String TOOL_SQL= "__tool_sql";
 
  public ToolPartitionScanner() {

    IToken toolComment = new Token(TOOL_COMMENT);
    IToken toolSQL = new Token(TOOL_SQL);

   
    ArrayList<IPredicateRule> rules = new ArrayList<IPredicateRule>();
    rules.add(new MultiLineCommentRule(toolComment));
    rules.add(new DoubleHyphenCommentRule(toolComment));
    rules.add(new DoubleSlashCommentRule(toolComment));
    rules.add(new MultiLineRule("SQL", ";", toolSQL));
    rules.add(new MultiLineRule("sql", ";", toolSQL));
    //rules.add(new MultiLineRule("SQL ", "do", toolSQL));
    //rules.add(new MultiLineRule("sql ", "do", toolSQL));
   
    IPredicateRule[] rulesArray = new IPredicateRule[rules.size()];
    rules.toArray(rulesArray);
    setPredicateRules(rulesArray);
  }
}
TOP

Related Classes of tool.editors.text.ToolPartitionScanner

TOP
Copyright © 2018 www.massapi.com. 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.