Package org.eclipse.jface.text.rules

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


    private void setTokens() {
        if (t_string != null) {
            return;
        }
        t_string = new Token(getTextAttribute(TokenHighlight.STRING));
        t_tildeTag = new Token(getTextAttribute(TokenHighlight.TILDE_TAG));
        t_escapeTag = new Token(getTextAttribute(TokenHighlight.ESCAPE_TAG));
        t_keyword = new Token(getTextAttribute(TokenHighlight.KEYWORD));
        t_var = new Token(getTextAttribute(TokenHighlight.VARIABLE));
        t_default = new Token(getTextAttribute(TokenHighlight.DEFAULT));
        t_arrow = new Token(getTextAttribute(TokenHighlight.ARROW));
        t_char = new Token(getTextAttribute(TokenHighlight.CHAR));
        t_macro = new Token(getTextAttribute(TokenHighlight.MACRO));
        t_atom = new Token(getTextAttribute(TokenHighlight.ATOM));
        t_integer = new Token(getTextAttribute(TokenHighlight.INTEGER));
        t_float = new Token(getTextAttribute(TokenHighlight.FLOAT));
        t_comment = new Token(getTextAttribute(TokenHighlight.COMMENT));
        t_edocTag = new Token(getTextAttribute(TokenHighlight.EDOC_TAG));
        t_htmlTag = new Token(getTextAttribute(TokenHighlight.HTML_TAG));
    }
View Full Code Here


        return new TextAttribute(fColorManager.getColor(data.getColor()), null,
                data.getStyles());
    }

    public void handleColorChange(final String id, final RGB newValue, final int style) {
        final Token token = getToken(id);
        fixTokenData(token, newValue, style);
    }
View Full Code Here

*/
public class DjangoPartitionScanner extends RuleBasedPartitionScanner {

  public DjangoPartitionScanner() {

    IToken djTag      = new Token(IDjangoPartitions.DJANGO_TAG);
    IToken djVariable    = new Token(IDjangoPartitions.DJANGO_VARIABLE);
    IToken djComment    = new Token(IDjangoPartitions.DJANGO_COMMENT);

    IToken htmlComment    = new Token(IDjangoPartitions.HTML_COMMENT);
    IToken htmlTag      = new Token(IDjangoPartitions.HTML_TAG);
    IToken htmlScriptlet = new Token(IDjangoPartitions.HTML_SCRIPTLET);
    IToken htmlDoctype   = new Token(IDjangoPartitions.HTML_DOCTYPE);
    IToken htmlDirective = new Token(IDjangoPartitions.HTML_DIRECTIVE);
    IToken javaScript    = new Token(IDjangoPartitions.JAVA_SCRIPT);
    IToken htmlCss       = new Token(IDjangoPartitions.HTML_CSS);

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

    rules.add(new MultiLineRule("{% comment %}", "{% endcomment %}", djComment));
    rules.add(new SingleLineRule("{#", "#}", djComment));
View Full Code Here

        updateColors();
    }

    public void updateColors() {
      int style = colorProvider.store.getInt(styleName);
        setDefaultReturnToken(new Token(colorProvider.getTextAttribute(colorName, style)));
    }
View Full Code Here

    public void updateColors() {
      List<IRule> rules = this.createRules();
      setRules(rules.toArray(new IRule[0]));

      int style = colorProvider.store.getInt(defaultStyleName);
      IToken defaultToken = new Token(colorProvider.getTextAttribute(defaultColorName, style));
      setDefaultReturnToken(defaultToken);
    }
View Full Code Here

*/
public class DjangoPartitionScanner extends RuleBasedPartitionScanner {

  public DjangoPartitionScanner() {

    IToken djTag      = new Token(IDjangoPartitions.DJANGO_TAG);
    IToken djVariable    = new Token(IDjangoPartitions.DJANGO_VARIABLE);
    IToken djComment    = new Token(IDjangoPartitions.DJANGO_COMMENT);

    IToken htmlComment    = new Token(IDjangoPartitions.HTML_COMMENT);
    IToken htmlTag      = new Token(IDjangoPartitions.HTML_TAG);
    IToken htmlScriptlet = new Token(IDjangoPartitions.HTML_SCRIPTLET);
    IToken htmlDoctype   = new Token(IDjangoPartitions.HTML_DOCTYPE);
    IToken htmlDirective = new Token(IDjangoPartitions.HTML_DIRECTIVE);
    IToken javaScript    = new Token(IDjangoPartitions.JAVA_SCRIPT);
    IToken htmlCss       = new Token(IDjangoPartitions.HTML_CSS);

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

    rules.add(new MultiLineRule("{% comment %}", "{% endcomment %}", djComment));
    rules.add(new SingleLineRule("{#", "#}", djComment));
View Full Code Here

//       if (italic)   style |= SWT.ITALIC;
//       return getToken(prefKey, style);
//  }

  public IToken getToken(String prefKey, int style) {
     Token token = (Token) tokenTable.get(prefKey);
     if (token == null){
         String colorName = store.getString(prefKey);
         if (colorName.equals(""))
           Logging.error("No such preference stored: " + prefKey);
         RGB rgb = StringConverter.asRGB(colorName);
           token = new Token(new TextAttribute(getColor(rgb), null, style));
         tokenTable.put(prefKey, token);
     }
     return token;
  }
View Full Code Here

public class XMLTagScanner extends RuleBasedScanner {

    public XMLTagScanner(ColorManager manager) {
        Color color = manager.getColor(PreferenceConstants.EDITOR_COLOR_STRING);
        IToken string = new Token(new TextAttribute(color));

        // CheckStyle:MagicNumber| OFF
        IRule[] rules = new IRule[3];
        // CheckStyle:MagicNumber| ON
View Full Code Here

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

public class XMLScanner extends RuleBasedScanner {

    public XMLScanner(ColorManager manager) {
        IToken procInstr = new Token(new TextAttribute(manager
                .getColor(PreferenceConstants.EDITOR_COLOR_PROC_INSTR)));

        IRule[] rules = new IRule[2];
        // Add rule for processing instructions
        rules[0] = new SingleLineRule("<?", "?>", procInstr);
View Full Code Here

    public static final String XML_TAG = "__xml_tag";

    public XMLPartitionScanner() {

        IToken xmlComment = new Token(XML_COMMENT);
        IToken tag = new Token(XML_TAG);

        IPredicateRule[] rules = new IPredicateRule[2];

        rules[0] = new MultiLineRule("<!--", "-->", xmlComment);
        rules[1] = new TagRule(tag);
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.