formatChoicer.setEnabled( index == 1 ); formatTagsBar.setEnabled( index == 1 ); commonTagsBar.setEnabled( index == 1 );
formatChoicer.setEnabled( index != PLAIN_INDEX ); formatTagsBar.setEnabled( index != PLAIN_INDEX ); commonTagsBar.setEnabled( index != PLAIN_INDEX );
	private void createToolBar( Composite composite )	{		ToolBar toolBar = new ToolBar( composite, SWT.FLAT );		toolBar.setLayoutData( new GridData( ) );		ToolItem copy = new ToolItem( toolBar, SWT.NONE );		copy.setImage( ReportPlatformUIImages.getImage( ISharedImages.IMG_TOOL_COPY ) );		copy.setToolTipText( TOOL_TIP_TEXT_COPY );		copy.addSelectionListener( new SelectionAdapter( ) {			public void widgetSelected( SelectionEvent e )			{				textEditor.copy( );			}		} );		ToolItem cut = new ToolItem( toolBar, SWT.NONE );		cut.setImage( ReportPlatformUIImages.getImage( ISharedImages.IMG_TOOL_CUT ) );		cut.setToolTipText( TOOL_TIP_TEXT_CUT );		cut.addSelectionListener( new SelectionAdapter( ) {			public void widgetSelected( SelectionEvent e )			{				textEditor.cut( );			}		} );		ToolItem paste = new ToolItem( toolBar, SWT.NONE );		paste.setImage( ReportPlatformUIImages.getImage( ISharedImages.IMG_TOOL_PASTE ) );		paste.setToolTipText( TOOL_TIP_TEXT_PASTE );		paste.addSelectionListener( new SelectionAdapter( ) {			public void widgetSelected( SelectionEvent e )			{				textEditor.paste( );			}		} );		ToolItem delete = new ToolItem( toolBar, SWT.NONE );		delete.setImage( ReportPlatformUIImages.getImage( ISharedImages.IMG_TOOL_DELETE ) );		delete.setToolTipText( TOOL_TIP_TEXT_DELETE );		delete.addSelectionListener( new SelectionAdapter( ) {			public void widgetSelected( SelectionEvent e )			{				if ( textEditor.getSelectionCount( ) > 0 )				{					textEditor.insert( "" ); //$NON-NLS-1$				}			}		} );		ToolItem undo = new ToolItem( toolBar, SWT.NONE );		undo.setImage( ReportPlatformUIImages.getImage( ISharedImages.IMG_TOOL_UNDO ) );		undo.setToolTipText( TOOL_TIP_TEXT_UNDO );		undo.addSelectionListener( new SelectionAdapter( ) {			public void widgetSelected( SelectionEvent e )			{				textViewer.doOperation( ITextOperationTarget.UNDO );			}		} );		ToolItem redo = new ToolItem( toolBar, SWT.NONE );		redo.setImage( ReportPlatformUIImages.getImage( ISharedImages.IMG_TOOL_REDO ) );		redo.setToolTipText( TOOL_TIP_TEXT_REDO );		redo.addSelectionListener( new SelectionAdapter( ) {			public void widgetSelected( SelectionEvent e )			{				textViewer.doOperation( ITextOperationTarget.REDO );			}		} );		// vertical separator between toolItems and combo		new ToolItem( toolBar, SWT.SEPARATOR );		textTypeChoicer = new CCombo( composite, SWT.FLAT | SWT.READ_ONLY );		GridData data = new GridData( GridData.HORIZONTAL_ALIGN_BEGINNING );		data.widthHint = textTypeChoicer.computeSize( SWT.DEFAULT, SWT.DEFAULT ).x + 100;		textTypeChoicer.setLayoutData( data );		textTypeChoicer.setBackground( PlatformUI.getWorkbench( )				.getDisplay( )				.getSystemColor( SWT.COLOR_LIST_BACKGROUND ) );		textTypeChoicer.setItems( new String[]{				Messages.getString( "TextEditDialog.choice.plainText" ), Messages.getString( "TextEditDialog.choice.HTML" ) //$NON-NLS-1$ //$NON-NLS-2$		} );		textTypeChoicer.select( handle.getContentType( )				.equals( DesignChoiceConstants.TEXT_CONTENT_TYPE_HTML ) ? 1 : 0 );		textTypeChoicer.addSelectionListener( new SelectionAdapter( ) {			public void widgetSelected( SelectionEvent e )			{				final int index = textTypeChoicer.getSelectionIndex( );				formatChoicer.setEnabled( index == 1 );				formatTagsBar.setEnabled( index == 1 );				commonTagsBar.setEnabled( index == 1 );				// set the enablement of all html tags when the text type is				// changed.				ToolItem[] toolItems = formatTagsBar.getItems( );				ToolItem[] commonTags = commonTagsBar.getItems( );				for ( int i = 1; i < toolItems.length; i++ )				{					toolItems[i].setEnabled( formatTagsBar.isEnabled( ) );				}				for ( int i = 1; i < commonTags.length; i++ )				{					commonTags[i].setEnabled( commonTagsBar.isEnabled( ) );				}				textEditor.setFocus( );			}		} );		// create common tags on the right of the text type choicer.		commonTagsBar = new ToolBar( composite, SWT.FLAT );		commonTagsBar.setLayoutData( new GridData( GridData.HORIZONTAL_ALIGN_BEGINNING ) );		commonTagsBar.setEnabled( textTypeChoicer.getSelectionIndex( ) == 1 );		createCommonTags( commonTagsBar );	}