Package org.eclipse.jface.text.rules

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


    syntaxTable.put(syntaxId, new Token(new TextAttribute(color, null,
        SWT.NORMAL)));
  }

  private void addSyntax(Enum<?> syntaxId, Color color, int style) {
    syntaxTable.put(syntaxId, new Token(new TextAttribute(color, null,
        style)));
  }
View Full Code Here


   * @param syntaxId
   *            the syntax id.
   * @return the text attribute.
   */
  public TextAttribute getTextAttribute(Enum<?> syntaxId) {
    Token t = syntaxTable.get(syntaxId);
    return (t == null ? null : (TextAttribute) t.getData());
  }
View Full Code Here

    public SchemaCodeScanner( SchemaTextAttributeProvider provider )
    {
        List<IRule> rules = new ArrayList<IRule>();

        IToken keyword = new Token( provider.getAttribute( SchemaTextAttributeProvider.KEYWORD_ATTRIBUTE ) );
        IToken string = new Token( provider.getAttribute( SchemaTextAttributeProvider.STRING_ATTRIBUTE ) );
        IToken undefined = new Token( provider.getAttribute( SchemaTextAttributeProvider.DEFAULT_ATTRIBUTE ) );
        IToken ATToken = new Token( provider.getAttribute( SchemaTextAttributeProvider.ATTRIBUTETYPE_ATTRIBUTE ) );
        IToken OCToken = new Token( provider.getAttribute( SchemaTextAttributeProvider.OBJECTCLASS_ATTRIBUTE ) );
        IToken oid = new Token( provider.getAttribute( SchemaTextAttributeProvider.OID_ATTRIBUTE ) );

        // Rules for Strings
        rules.add( new SingleLineRule( "\"", "\"", string, '\0', true ) ); //$NON-NLS-1$ //$NON-NLS-2$
        rules.add( new SingleLineRule( "'", "'", string, '\0', true ) ); //$NON-NLS-1$ //$NON-NLS-2$
        // Generic rule for whitespaces
View Full Code Here

     */
    public ACICodeScanner( ACITextAttributeProvider provider )
    {
        List<IRule> rules = new ArrayList<IRule>();

        IToken keyword = new Token( provider.getAttribute( ACITextAttributeProvider.KEYWORD_ATTRIBUTE ) );
        IToken undefined = new Token( provider.getAttribute( ACITextAttributeProvider.DEFAULT_ATTRIBUTE ) );
        IToken string = new Token( provider.getAttribute( ACITextAttributeProvider.STRING_ATTRIBUTE ) );
        IToken grantValue = new Token( provider.getAttribute( ACITextAttributeProvider.GRANT_VALUE ) );
        IToken denyValue = new Token( provider.getAttribute( ACITextAttributeProvider.DENY_VALUE ) );
        IToken identification = new Token( provider.getAttribute( ACITextAttributeProvider.IDENTIFICATION_ATTRIBUTE ) );
        IToken precedence = new Token( provider.getAttribute( ACITextAttributeProvider.PRECEDENCE_ATTRIBUTE ) );
        IToken authenticationLevel = new Token( provider
            .getAttribute( ACITextAttributeProvider.AUTHENTICATIONLEVEL_ATTRIBUTE ) );
        IToken itemOrUserFirst = new Token( provider.getAttribute( ACITextAttributeProvider.ITEMORUSERFIRST_ATTRIBUTE ) );
        IToken user = new Token( provider.getAttribute( ACITextAttributeProvider.USER_ATTRIBUTE ) );

        // Rules for Strings
        rules.add( new SingleLineRule( "\"", "\"", string, '\0', true ) ); //$NON-NLS-1$ //$NON-NLS-2$
        rules.add( new SingleLineRule( "'", "'", string, '\0', true ) ); //$NON-NLS-1$ //$NON-NLS-2$
        // Generic rule for whitespaces
View Full Code Here

  private static Color KEY_ATTR_COLOR = new Color(Display.getCurrent(), new RGB(0, 128, 128));
  private static Color COMMENT_COLOR = new Color(Display.getCurrent(), new RGB(0, 128, 0));
  private static Color STRING_COLOR = new Color(Display.getCurrent(), new RGB(0, 0, 128));

  public MaudeRuleScanner() {
    IToken keyModToken = new Token(new TextAttribute(KEY_MOD_COLOR,null,SWT.BOLD));
    IToken keyModEltToken = new Token(new TextAttribute(KEY_MODELT_COLOR,null,SWT.BOLD));
    IToken keyStatToken = new Token(new TextAttribute(KEY_STAT_COLOR,null,SWT.BOLD));
    IToken keyAttrToken = new Token(new TextAttribute(KEY_ATTR_COLOR,null,SWT.BOLD));
    IToken commentToken = new Token(new TextAttribute(COMMENT_COLOR));
    IToken stringToken = new Token(new TextAttribute(STRING_COLOR));


    IWordDetector wordDet = new IWordDetector() {
      public boolean isWordStart(char c) {
        return (Character.isJavaIdentifierStart(c));
View Full Code Here

  protected MaudeRuleScanner getTagScanner() {
    if (scanner == null) {
      scanner = new MaudeRuleScanner();
      scanner.setDefaultReturnToken(
        new Token(new TextAttribute(DEFAULT_COLOR)));
    }
    return scanner;
  }
View Full Code Here

      // if the offset of the look ahead token is higher than the current offset,
      // fScanner has skipped characters (either whitespace or comments)
      if (fOffset < laOffset) {
        // generate a new syntactic presentation token from offset to lookahead offset
        // this token can be used to create syntax highlighting for comments
        fToken = new Token(fManager.getCommentsPresentationStyle());
        fLength = laOffset - fOffset;
      }
     
      //else create new token from the Coco Scanner's current token.
      else {
        fOffset = laOffset;
        fLength = getPeekTokenVal().length();

        // if the end of the document hasn't been reached yet,
        // generate a new syntactic presentation token
        if (fOffset < fEndPos) {
          fToken = new Token(fManager.getPresentationStyle(getPeekTokenKind()));
        }
        // else return end of file
        else {
          fToken = Token.EOF;
        }
View Full Code Here

  private static Color KEY_ATTR_COLOR = new Color(Display.getCurrent(), new RGB(0, 128, 128));
  private static Color COMMENT_COLOR = new Color(Display.getCurrent(), new RGB(0, 128, 0));
  private static Color STRING_COLOR = new Color(Display.getCurrent(), new RGB(0, 0, 128));

  public MaudeRuleScanner() {
    IToken keyModToken = new Token(new TextAttribute(KEY_MOD_COLOR,null,SWT.BOLD));
    IToken keyModEltToken = new Token(new TextAttribute(KEY_MODELT_COLOR,null,SWT.BOLD));
    IToken keyStatToken = new Token(new TextAttribute(KEY_STAT_COLOR,null,SWT.BOLD));
    IToken keyAttrToken = new Token(new TextAttribute(KEY_ATTR_COLOR,null,SWT.BOLD));
    IToken commentToken = new Token(new TextAttribute(COMMENT_COLOR));
    IToken stringToken = new Token(new TextAttribute(STRING_COLOR));


    IWordDetector wordDet = new IWordDetector() {
      public boolean isWordStart(char c) {
        return (Character.isJavaIdentifierStart(c));
View Full Code Here

  protected MaudeRuleScanner getTagScanner() {
    if (scanner == null) {
      scanner = new MaudeRuleScanner();
      scanner.setDefaultReturnToken(
        new Token(new TextAttribute(DEFAULT_COLOR)));
    }
    return scanner;
  }
View Full Code Here

public class JsonScanner extends RuleBasedScanner {

  public JsonScanner(JsonColorProvider provider) {
    super();
   
    IToken string = new Token(new TextAttribute(provider.getColor(JsonColorProvider.STRING)));
    IToken value = new Token(new TextAttribute(provider.getColor(JsonColorProvider.VALUE)));
    IToken defaultText = new Token(new TextAttribute(provider.getColor(JsonColorProvider.DEFAULT)));
    IToken nullValue = new Token(new TextAttribute(provider.getColor(JsonColorProvider.NULL)));
   
    List<IRule> rules= new LinkedList<IRule>();
   
    rules.add(new SingleLineRule(":\"", "\"", value, '\\'));
    rules.add(new SingleLineRule("\"", "\"", string, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
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.