GridData data = new GridData( GridData.FILL_BOTH ); viewer.getControl( ).setLayoutData( data );   addDropSupportToViewer( );   viewer.getTextWidget( ).addKeyListener( new KeyListener( ) {
viewer.getTextWidget( ).addKeyListener( new KeyListener( ) {
	private void createTextualQueryComposite( Composite parent )	{		Composite composite = new Composite( parent, SWT.FILL				| SWT.LEFT_TO_RIGHT );		GridLayout layout = new GridLayout( );		layout.numColumns = 1;		composite.setLayout( layout );		CompositeRuler ruler = new CompositeRuler( );		LineNumberRulerColumn lineNumbers = new LineNumberRulerColumn( );		ruler.addDecorator( 0, lineNumbers );		viewer = new SourceViewer( composite, ruler, SWT.H_SCROLL				| SWT.V_SCROLL );		sourceViewerConfiguration = new JdbcSQLSourceViewerConfiguration( this.getDataSetDesign( ) );		viewer.configure( sourceViewerConfiguration );		doc = new Document( getQueryText( ) );		FastPartitioner partitioner = new FastPartitioner( new SQLPartitionScanner( ),				new String[]{						SQLPartitionScanner.SINGLE_LINE_COMMENT1,						SQLPartitionScanner.SINGLE_LINE_COMMENT2,						SQLPartitionScanner.MULTI_LINE_COMMENT,						IDocument.DEFAULT_CONTENT_TYPE				} );		partitioner.connect( doc );		doc.setDocumentPartitioner( partitioner );		viewer.setDocument( doc );		viewer.getTextWidget( ).setFont( JFaceResources.getTextFont( ) );		viewer.getTextWidget( )				.addBidiSegmentListener( new BidiSegmentListener( ) {					/*					 * @see org.eclipse.swt.custom.BidiSegmentListener#lineGetSegments(org.eclipse.swt.custom.BidiSegmentEvent)					 */					public void lineGetSegments( BidiSegmentEvent event )					{						event.segments = SQLUtility.getBidiLineSegments( event.lineText );					}				} );		attachMenus( viewer );		GridData data = new GridData( GridData.FILL_BOTH );		viewer.getControl( ).setLayoutData( data );		// Add drop support to the viewer		addDropSupportToViewer( );		// add support of additional accelerated key		viewer.getTextWidget( ).addKeyListener( new KeyListener( ) {			public void keyPressed( KeyEvent e )			{				if ( isUndoKeyPress( e ) )				{					viewer.doOperation( ITextOperationTarget.UNDO );				}				else if ( isRedoKeyPress( e ) )				{					viewer.doOperation( ITextOperationTarget.REDO );				}			}			private boolean isUndoKeyPress( KeyEvent e )			{				// CTRL + z				return ( ( e.stateMask & SWT.CONTROL ) > 0 )						&& ( ( e.keyCode == 'z' ) || ( e.keyCode == 'Z' ) );			}			private boolean isRedoKeyPress( KeyEvent e )			{				// CTRL + y				return ( ( e.stateMask & SWT.CONTROL ) > 0 )						&& ( ( e.keyCode == 'y' ) || ( e.keyCode == 'Y' ) );			}			public void keyReleased( KeyEvent e )			{				// do nothing			}		} );	}