1 11 package org.eclipse.jdt.internal.ui.propertiesfileeditor; 12 13 import org.eclipse.jface.text.rules.ICharacterScanner; 14 import org.eclipse.jface.text.rules.IToken; 15 import org.eclipse.jface.text.rules.IWordDetector; 16 import org.eclipse.jface.text.rules.WordPatternRule; 17 18 19 24 public final class LeadingWhitespacePredicateRule extends WordPatternRule { 25 26 27 private static class DummyDetector implements IWordDetector { 28 29 32 public boolean isWordStart(char c) { 33 return false; 34 } 35 36 39 public boolean isWordPart(char c) { 40 return false; 41 } 42 } 43 44 45 50 public LeadingWhitespacePredicateRule(IToken token, String whitespace) { 51 super(new DummyDetector(), whitespace, "dummy", token); setColumnConstraint(0); 53 } 54 55 58 protected boolean endSequenceDetected(ICharacterScanner scanner) { 59 int c; 60 do { 61 c= scanner.read(); 62 } while (Character.isWhitespace((char) c)); 63 64 scanner.unread(); 65 66 return true; 67 } 68 } 69 | Popular Tags |