### Eclipse Workspace Patch 1.0
#P org.eclipse.jface.text
Index: src/org/eclipse/jface/text/rules/WhitespaceRule.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WhitespaceRule.java,v
retrieving revision 1.11
diff -u -r1.11 WhitespaceRule.java
--- src/org/eclipse/jface/text/rules/WhitespaceRule.java 9 May 2007 12:16:05 -0000 1.11
+++ src/org/eclipse/jface/text/rules/WhitespaceRule.java 17 Oct 2008 13:42:42 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Anton Leherbauer (Wind River Systems) - http://bugs.eclipse.org/
*******************************************************************************/
package org.eclipse.jface.text.rules;
@@ -27,16 +28,33 @@
/** The whitespace detector used by this rule */
protected IWhitespaceDetector fDetector;
+ /** The token returned for whitespace */
+ private final IToken fWhitespaceToken;
+
/**
- * Creates a rule which, with the help of an
- * whitespace detector, will return a whitespace
- * token when a whitespace is detected.
- *
+ * Creates a rule which, with the help of an whitespace detector, will return
+ * {@link Token#WHITESPACE} when a whitespace is detected.
+ *
* @param detector the rule's whitespace detector, may not be null
*/
public WhitespaceRule(IWhitespaceDetector detector) {
+ this(detector, Token.WHITESPACE);
+ }
+
+ /**
+ * Creates a rule which, with the help of an whitespace detector, will return the given
+ * whitespace token when a whitespace is detected.
+ *
+ * @param detector the rule's whitespace detector, may not be null
+ * @param token the token returned for whitespace, may not be null
+ *
+ * @since 3.5
+ */
+ public WhitespaceRule(IWhitespaceDetector detector, IToken token) {
Assert.isNotNull(detector);
+ Assert.isNotNull(token);
fDetector= detector;
+ fWhitespaceToken= token;
}
/*
@@ -49,7 +67,7 @@
c= scanner.read();
} while (fDetector.isWhitespace((char) c));
scanner.unread();
- return Token.WHITESPACE;
+ return fWhitespaceToken;
}
scanner.unread();