JSSyntaxContext context = new JSSyntaxContext( ); try { context.setVariable( IReportGraphicConstants.REPORT_KEY_WORD, IReportDesign.class ); } catch ( ClassNotFoundException e ) { } sourceViewer.configure( new JSSourceViewerConfiguration( context ) );
sourceViewer.configure( new JSSourceViewerConfiguration( ) );
	private void createExpressionField( Composite parent )	{		Composite expressionArea = new Composite( parent, SWT.NONE );		expressionArea.setLayout( new GridLayout( 2, false ) );		expressionArea.setLayoutData( new GridData( GridData.FILL_BOTH ) );		Composite composite = new Composite( expressionArea, SWT.BORDER );		composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );		composite.setLayout( UIUtil.createGridLayoutWithoutMargin( ) );		CompositeRuler ruler = new CompositeRuler( );		ruler.addDecorator( 0, new LineNumberRulerColumn( ) );		sourceViewer = new SourceViewer( composite, ruler, SWT.H_SCROLL				| SWT.V_SCROLL );		JSSyntaxContext context = new JSSyntaxContext( );		try		{			context.setVariable( IReportGraphicConstants.REPORT_KEY_WORD,					IReportDesign.class ); //$NON-NLS-1$		}		catch ( ClassNotFoundException e )		{		}		sourceViewer.configure( new JSSourceViewerConfiguration( context ) );		// sourceViewer.configure( new SourceViewerConfiguration( ) );		// Document doc = new Document( expression );		// sourceViewer.setDocument( doc );		if ( expression != null )		{			JSEditorInput editorInput = new JSEditorInput( expression );			JSDocumentProvider documentProvider = new JSDocumentProvider( );			try			{				documentProvider.connect( editorInput );			}			catch ( CoreException e )			{				ExceptionHandler.handle( e );			}			IDocument document = documentProvider.getDocument( editorInput );			sourceViewer.setDocument( document );		}		GridData gd = new GridData( GridData.FILL_BOTH );		gd.heightHint = 150;		sourceViewer.getControl( ).setLayoutData( gd );		sourceViewer.getTextWidget( ).addKeyListener( new KeyAdapter( ) {			public void keyPressed( KeyEvent e )			{				if ( isUndoKeyPress( e ) )				{					sourceViewer.doOperation( ITextOperationTarget.UNDO );				}				else if ( isRedoKeyPress( e ) )				{					sourceViewer.doOperation( ITextOperationTarget.REDO );				}			}			private boolean isUndoKeyPress( KeyEvent e )			{				return ( ( e.stateMask & SWT.CONTROL ) > 0 )						&& ( ( e.keyCode == 'z' ) || ( e.keyCode == 'Z' ) );			}			private boolean isRedoKeyPress( KeyEvent e )			{				return ( ( e.stateMask & SWT.CONTROL ) > 0 )						&& ( ( e.keyCode == 'y' ) || ( e.keyCode == 'Y' ) );			}		} );		buttonBar = new Composite( expressionArea, SWT.NONE );		buttonBar.setLayout( UIUtil.createGridLayoutWithoutMargin( ) );		buttonBar.setLayoutData( new GridData( GridData.FILL_VERTICAL ) );	}