Examples of RuleBasedScanner


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

  /**
   * Creates or Returns the scanner for DOCTYPE decl.
   */
  protected RuleBasedScanner getDoctypeScanner(){
    if (_doctypeScanner == null) {
      _doctypeScanner = new RuleBasedScanner();
      _doctypeScanner.setDefaultReturnToken(
          _colorProvider.getToken(HTMLPlugin.PREF_COLOR_DOCTYPE));
    }
    return _doctypeScanner;
  }
View Full Code Here

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

    this.colorProvider = colorProvider;
  }
 
  private RuleBasedScanner getCommentScanner(){
    if (commentScanner == null) {
      commentScanner = new RuleBasedScanner();
      commentScanner.setDefaultReturnToken(
          colorProvider.getToken(HTMLPlugin.PREF_COLOR_JSCOMMENT));
    }
    return commentScanner;
  }
View Full Code Here

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

    this.colorProvider = colorProvider;
  }

  private RuleBasedScanner getCommentScanner() {
    if (commentScanner == null) {
      commentScanner = new RuleBasedScanner();
      commentScanner.setDefaultReturnToken(colorProvider.getToken(HTMLPlugin.PREF_COLOR_CSSCOMMENT));
    }
    return commentScanner;
  }
View Full Code Here

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

  private void addDelegatedKeywords(PresentationReconciler reconciler) {
    Collection delegates = mode.getDelegates().keySet();
    for (Iterator rules = delegates.iterator(); rules.hasNext();) {
      String mungedName = (String)rules.next();
      Rule rule = (Rule) mode.getDelegates().get(mungedName);
      RuleBasedScanner scanner = getDelegateScanner(rule);
      DefaultDamagerRepairer dr= new DefaultDamagerRepairer(scanner);
      reconciler.setDamager(dr, mungedName);
      reconciler.setRepairer(dr, mungedName);
    }
  }
View Full Code Here

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

      reconciler.setRepairer(dr, mungedName);
    }
  }

  private RuleBasedScanner getDelegateScanner(Rule rule) {
    RuleBasedScanner scanner = new RuleBasedScanner();
    List rules = new ArrayList();
   
    String colorName = colorManager.colorForType(rule.getDefaultTokenType());
    IToken defaultToken = newToken(colorName);
    scanner.setDefaultReturnToken(defaultToken);
    ColoringEditorTools.add(rule, rules, new ITokenFactory() {
      public IToken makeToken(Type type) {
        String color = colorManager.colorForType(type.getColor());
        return newToken(color);
      }
    });
    addTextSequenceRules(rule, rules, defaultToken);
   
    scanner.setRules((IRule[]) rules.toArray(new IRule[rules.size()]));
    return scanner;
  }
View Full Code Here

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

  private void setupScannerType(PresentationReconciler reconciler, String typeName) {
    String[] contentTypes = mode.getContentTypes();
    for (int i = 0; i < contentTypes.length; i++) {
      String contentType = contentTypes[i];
      if(!contentType.startsWith(typeName)) continue;
      RuleBasedScanner scanner = new RuleBasedScanner();     
      String type = contentType.substring(contentType.lastIndexOf('.') + 1);
      IToken defaultToken = newToken(colorManager.colorForType(type));
      scanner.setDefaultReturnToken(defaultToken);
      DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);
      reconciler.setDamager(dr, contentType);
      reconciler.setRepairer(dr, contentType);
    }
  }
View Full Code Here

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

  private void setupScannerTypeForMark(PresentationReconciler reconciler) {
    String[] contentTypes = mode.getContentTypes();
    for (int i = 0; i < contentTypes.length; i++) {
      String contentType = contentTypes[i];
      if(contentType.startsWith(Type.MARK_PREVIOUS) || contentType.startsWith(Type.MARK_FOLLOWING)) {
        RuleBasedScanner scanner = new RuleBasedScanner();     
        String colorType = contentType.substring(contentType.lastIndexOf('.') + 1);
        LToken defaultToken = (LToken) newToken(colorManager.colorForType(colorType), true);
        defaultToken.setLength(getLength(contentType));
        defaultToken.isPrevious(contentType.startsWith(Type.MARK_PREVIOUS));
        scanner.setDefaultReturnToken(defaultToken);
        DefaultDamagerRepairer dr = new MarkDamagerRepairer(scanner);
        reconciler.setDamager(dr, contentType);
        reconciler.setRepairer(dr, contentType);
      }
    }
View Full Code Here

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

      return 0;
    }
  }

  private void addKeywordHighlighting(PresentationReconciler reconciler) {
    RuleBasedScanner codeScanner = getCodeScanner();
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(codeScanner);
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
  }
View Full Code Here

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

    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
  }

  public RuleBasedScanner getCodeScanner() {
    RuleBasedScanner scanner = new RuleBasedScanner();
    List rules = new ArrayList();
    Rule main = mode.getDefaultRuleSet();
    addWhitespaceRule(rules);

    IToken defaultToken = newToken(ColorsPreferencePage.NULL_COLOR);
    addTextSequenceRules(main, rules, defaultToken);

    IRule[] result = new IRule[rules.size()];
    rules.toArray(result);
    scanner.setRules(result);
    return scanner;
  }
View Full Code Here

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

public class StructuredDocumentDamagerRepairer extends DefaultDamagerRepairer {

  private LineStyleProvider fProvider = null;

  public StructuredDocumentDamagerRepairer(LineStyleProvider provider) {
    super(new RuleBasedScanner());
    Assert.isNotNull(provider);
    fProvider = provider;
  }
View Full Code Here
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.