org.eclipse.jface.text.rules.IWhitespaceDetector Java Examples

The following examples show how to use org.eclipse.jface.text.rules.IWhitespaceDetector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SQLKeywordScanner.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 *  
 */
public SQLKeywordScanner( )
{
	super( );
	IToken sqlKeywordsToken = new Token( new TextAttribute( ColorManager.getColor(127, 0, 85), null, SWT.BOLD ) );
	ArrayList rules = new ArrayList( );
	rules.add( new SQLKeywordRule( sqlKeywordsToken, reservedwords ) );
	rules.add( new SQLKeywordRule( sqlKeywordsToken, types ) );
	rules.add( new SQLKeywordRule( sqlKeywordsToken, constants ) );
	rules.add( new SQLKeywordRule( sqlKeywordsToken, functions ) );
	rules.add( new SQLKeywordRule( sqlKeywordsToken, predicates ) );
	
	// Add generic whitespace rule.
	rules.add( new WhitespaceRule( new IWhitespaceDetector( ) {

		public boolean isWhitespace( char c )
		{
			return Character.isWhitespace( c );
		}
	} ) );

	setRules( (IRule[]) rules.toArray( new IRule[rules.size( )] ) );
	this.setDefaultReturnToken( new Token( new TextAttribute( Display.getDefault( ).getSystemColor( SWT.COLOR_LIST_FOREGROUND ))));
}
 
Example #2
Source File: JSScanner.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new JSScanner object.
 * 
 */
public JSScanner( )
{
	List rules = new ArrayList( );

	// Add generic whitespace rule.
	rules.add( new WhitespaceRule( new IWhitespaceDetector( ) {

		public boolean isWhitespace( char c )
		{
			return Character.isWhitespace( c );
		}
	} ) );

	IRule[] result = new IRule[rules.size( )];
	rules.toArray( result );
	setRules( result );
}
 
Example #3
Source File: DocumentHelper.java    From tlaplus with MIT License 4 votes vote down vote up
/**
 * Factory method for the whitespace detector
 */
public static IWhitespaceDetector getDefaultWhitespaceDetector()
{
    return new TLAWhitespaceDetector();
}