SessionHandleAdapter.getInstance( ) .getCommandStack( ) .startTrans( Messages.getString( "BordersPage.Trans.SelectBorder" ) );
	public Control createControl( Composite parent )	{		content = new Composite( parent, SWT.NONE );		GridLayout layout = UIUtil.createGridLayoutWithoutMargin( 2, false );		layout.marginHeight = 1;		layout.marginWidth = 1;		layout.horizontalSpacing = 10;		content.setLayout( layout );		content.setLayoutData( new GridData( GridData.FILL_BOTH ) );		Composite choices = new Composite( content, SWT.NONE );		GridData data = new GridData( GridData.FILL_BOTH );		choices.setLayoutData( data );		layout = WidgetUtil.createGridLayout( 2 );		layout.marginHeight = 1;		layout.marginWidth = 2;		choices.setLayout( layout );		Label styleLabel = FormWidgetFactory.getInstance( )				.createLabel( choices, SWT.LEFT, isFormStyle );		styleLabel.setText( styleProvider.getDisplayName( ) );		styleLabel.setLayoutData( new GridData( ) );		if ( isFormStyle )		{			styleCombo = FormWidgetFactory.getInstance( )					.createStyleCombo( choices, (IComboProvider) styleProvider );		}		else		{			styleCombo = new StyleCombo( choices,					style,					(IComboProvider) styleProvider );		}		data = new GridData( );		data.widthHint = 200;		styleCombo.setLayoutData( data );		styleCombo.setItems( ( (IComboProvider) styleProvider ).getItems( ) );		Label colorLabel = FormWidgetFactory.getInstance( )				.createLabel( choices, SWT.LEFT, isFormStyle );		colorLabel.setText( colorProvider.getDisplayName( ) );		colorLabel.setLayoutData( new GridData( ) );		builder = new ColorBuilder( choices, SWT.NONE, isFormStyle );		builder.setChoiceSet( colorProvider.getElementChoiceSet( ) );		colorProvider.setIndex( IColorConstants.BLACK );		data = new GridData( );		data.widthHint = 200;		data.heightHint = builder.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y;		builder.setLayoutData( data );		Label widthLabel = FormWidgetFactory.getInstance( )				.createLabel( choices, SWT.LEFT, isFormStyle );		widthLabel.setText( widthProvider.getDisplayName( ) );		widthLabel.setLayoutData( new GridData( ) );		if ( isFormStyle )		{			widthCombo = FormWidgetFactory.getInstance( )					.createStyleCombo( choices, (IComboProvider) widthProvider );		}		else		{			widthCombo = new StyleCombo( choices,					style,					(IComboProvider) widthProvider );		}		widthProvider.setIndex( widthProvider.getItems( )[1].toString( ) );		data = new GridData( );		data.widthHint = 200;		widthCombo.setLayoutData( data );		widthCombo.setItems( ( (IComboProvider) widthProvider ).getItems( ) );		Composite composite = new Composite( choices, SWT.NONE );		layout = new GridLayout( );		layout.horizontalSpacing = 7;		layout.numColumns = toggleProviders.length + 1;		composite.setLayout( layout );		data = new GridData( );		data.horizontalSpan = 2;		composite.setLayoutData( data );		toggles = new Button[toggleProviders.length];		for ( int i = 0; i < toggleProviders.length; i++ )		{			Button button = new Button( composite, SWT.TOGGLE );			toggles[i] = button;			button.setLayoutData( new GridData( ) );			button.setToolTipText( toggleProviders[i].getTooltipText( ) );			button.setImage( ReportPlatformUIImages.getImage( toggleProviders[i].getImageName( ) ) );			final BorderToggleDescriptorProvider provider = toggleProviders[i];			button.addSelectionListener( new SelectionAdapter( ) {				public void widgetSelected( SelectionEvent e )				{					SessionHandleAdapter.getInstance( )							.getCommandStack( )							.startTrans( Messages.getString( "BordersPage.Trans.SelectBorder" ) );					if ( ( (Button) e.widget ).getSelection( ) )					{						BorderInfomation information = new BorderInfomation( );						information.setPosition( provider.getPosition( ) );						information.setColor( builder.getRGB( ) );						information.setStyle( (String) styleCombo.getSelectedItem( ) );						information.setWidth( (String) widthCombo.getSelectedItem( ) );						previewCanvas.setBorderInfomation( information );						restoreInfo = information;						try						{							provider.save( information );						}						catch ( Exception e1 )						{							ExceptionHandler.handle( e1 );						}						checkToggleButtons( );					}					else					{						BorderInfomation oldInfo = (BorderInfomation) provider.load( );						if ( !( oldInfo.getStyle( ).equals( (String) styleCombo.getSelectedItem( ) ) )								|| !( oldInfo.getColor( ).equals( builder.getRGB( ) ) )								|| !( oldInfo.getWidth( ).equals( (String) widthCombo.getSelectedItem( ) ) ) )						{							BorderInfomation information = new BorderInfomation( );							information.setPosition( provider.getPosition( ) );							information.setColor( builder.getRGB( ) );							information.setStyle( (String) styleCombo.getSelectedItem( ) );							information.setWidth( (String) widthCombo.getSelectedItem( ) );							previewCanvas.setBorderInfomation( information );							restoreInfo = information;							try							{								provider.save( information );							}							catch ( Exception e1 )							{								ExceptionHandler.handle( e1 );							}							( (Button) e.widget ).setSelection( true );						}						else						{							previewCanvas.removeBorderInfomation( provider.getPosition( ) );							if ( allButton.getSelection( ) )								allButton.setSelection( false );							try							{								provider.reset( );							}							catch ( Exception e1 )							{								ExceptionHandler.handle( e1 );							}						}					}					previewCanvas.redraw( );					SessionHandleAdapter.getInstance( )							.getCommandStack( )							.commit( );				}			} );		}		allButton = new Button( composite, SWT.TOGGLE );		allButton.setImage( ReportPlatformUIImages.getImage( IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_FRAME ) );		allButton.setToolTipText( Messages.getString( "BordersPage.Tooltip.All" ) );		allButton.setLayoutData( new GridData( ) );		allButton.addSelectionListener( new SelectionAdapter( ) {			public void widgetSelected( SelectionEvent e )			{				SessionHandleAdapter.getInstance( )						.getCommandStack( )						.startTrans( Messages.getString( "BordersPage.Trans.SelectAllborders" ) );				if ( ( (Button) e.widget ).getSelection( ) )				{					for ( int i = 0; i < toggleProviders.length; i++ )					{						BorderInfomation information = new BorderInfomation( );						information.setPosition( toggleProviders[i].getPosition( ) );						information.setColor( builder.getRGB( ) );						information.setStyle( (String) styleCombo.getSelectedItem( ) );						information.setWidth( (String) widthCombo.getSelectedItem( ) );						toggles[i].setSelection( true );						previewCanvas.setBorderInfomation( information );						try						{							toggleProviders[i].save( information );						}						catch ( Exception e1 )						{							ExceptionHandler.handle( e1 );						}					}					restoreInfo = (BorderInfomation) toggleProviders[toggleProviders.length - 1].load( );				}				else				{					boolean reset = true;					for ( int i = 0; i < toggleProviders.length; i++ )					{						BorderInfomation info = (BorderInfomation) toggleProviders[i].load( );						if ( !( info.getStyle( ).equals( (String) styleCombo.getSelectedItem( ) ) )								|| !( info.getColor( ).equals( builder.getRGB( ) ) )								|| !( info.getWidth( ).equals( (String) widthCombo.getSelectedItem( ) ) ) )						{							reset = false;							break;						}					}					if ( reset )					{						for ( int i = 0; i < toggleProviders.length; i++ )						{							previewCanvas.removeBorderInfomation( toggleProviders[i].getPosition( ) );							toggles[i].setSelection( false );							try							{								toggleProviders[i].reset( );							}							catch ( Exception e1 )							{								ExceptionHandler.handle( e1 );							}						}					}					else					{						for ( int i = 0; i < toggleProviders.length; i++ )						{							BorderInfomation information = new BorderInfomation( );							information.setPosition( toggleProviders[i].getPosition( ) );							information.setColor( builder.getRGB( ) );							information.setStyle( (String) styleCombo.getSelectedItem( ) );							information.setWidth( (String) widthCombo.getSelectedItem( ) );							previewCanvas.setBorderInfomation( information );							restoreInfo = information;							try							{								toggleProviders[i].save( information );							}							catch ( Exception e1 )							{								ExceptionHandler.handle( e1 );							}						}						( (Button) e.widget ).setSelection( true );					}				}				previewCanvas.redraw( );				SessionHandleAdapter.getInstance( ).getCommandStack( ).commit( );			}		} );		Composite previewContainer = new Composite( content, SWT.NONE );		data = new GridData( GridData.FILL_BOTH );		previewContainer.setLayoutData( data );		layout = new GridLayout( );		layout.numColumns = 2;		layout.marginHeight = 1;		layout.marginWidth = 10;		previewContainer.setLayout( layout );		Label previewLabel = FormWidgetFactory.getInstance( )				.createLabel( previewContainer, SWT.LEFT, isFormStyle );		data = new GridData( GridData.VERTICAL_ALIGN_BEGINNING );		previewLabel.setLayoutData( data );		previewLabel.setText( Messages.getString( "BordersPage.text.Preview" ) );		previewCanvas = new BorderCanvas( previewContainer, SWT.NONE );		data = new GridData( );		data.widthHint = 130;		data.heightHint = 130;		previewCanvas.setLayoutData( data );		return content;	}