String fileName = dialog.open( );
String fileName = previewImageText.getText( ).trim( ); if(fileName.length( ) != 0) { File file = new File( fileName ); if ( fileName.indexOf( '/' ) < 0 && fileName.indexOf( '\\' ) < 0 ) { if ( ReportPlugin.getDefault( ).getTemplatePreference( ) != null && ReportPlugin.getDefault( ) .getTemplatePreference( ) .trim( ) .length( ) != 0 ) { String path = ReportPlugin.getDefault( ) .getTemplatePreference( ) .trim( ); file = new File( path, fileName ); if ( file.exists( ) && file.isFile( ) ) { dialog.setFileName( file.getPath( ) ); } } } else if ( file.exists( ) && file.isFile( ) ) { dialog.setFileName( fileName ); } }   fileName = dialog.open( );
	public void createControl( Composite parent )	{		Composite container = new Composite( parent, SWT.NONE );		GridLayout gridLayout = new GridLayout( );		gridLayout.numColumns = 3;		container.setLayout( gridLayout );		new Label( container, SWT.NONE ).setText( LABEL_DISPLAY_NAME );		nameText = createText( container, 2, 1 );		if ( module != null				&& module.getProperty( ModuleHandle.DISPLAY_NAME_PROP ) != null )			nameText.setText( module.getDisplayName( ) );		nameText.addModifyListener( new ModifyListener( ) {			public void modifyText( ModifyEvent e )			{				checkStatus();							}		} );				new Label( container, SWT.NONE ).setText( LABEL_DESCRIPTION );		descText = createText( container, 2, 5 );		if ( module != null				&& module.getProperty( ModuleHandle.DESCRIPTION_PROP ) != null )			descText.setText( (String) module.getProperty( ModuleHandle.DESCRIPTION_PROP ) );		descText.addModifyListener( new ModifyListener( ) {			public void modifyText( ModifyEvent e )			{				checkStatus();			}		} );				new Label( container, SWT.NONE ).setText( LABEL_IMAGE );		previewImageText = createText( container, 1, 1 );		if ( module != null && module.getIconFile( ) != null )			previewImageText.setText( module.getIconFile( ) );		previewImageText.addModifyListener( new ModifyListener( ) {			public void modifyText( ModifyEvent e )			{				checkStatus();				validate( );			}		} );		Button chooseBtn = new Button( container, SWT.NONE );		chooseBtn.setText( BTN_CHOOSE );		chooseBtn.addSelectionListener( new SelectionListener( ) {			public void widgetSelected( SelectionEvent e )			{				FileDialog dialog = new FileDialog( PlatformUI.getWorkbench( )						.getDisplay( )						.getActiveShell( ) );				dialog.setText( BROWSE_TITLE );				dialog.setFilterExtensions( IMAGE_FILEFILTERS );				String fileName = dialog.open( );				if ( fileName == null )				{					return;				}				previewImageText.setText( fileName );			}			public void widgetDefaultSelected( SelectionEvent e )			{			}		} );		nameText.forceFocus( );		setControl( container );		UIUtil.bindHelp( getControl(),IHelpContextIds.PUBLISH_TEMPLATE_WIZARD_ID );  	}