if ( file.exists( ) )
ReportDesignHandle handle = SessionHandleAdapter.getInstance( ) .getSessionHandle( ) .createDesignFromTemplate( sourceFileName ); if ( ReportPlugin.getDefault( ).getEnableCommentPreference( ) )
	private void doFinish( IPath containerName, String fileName,			InputStream stream, String cheatSheetId, boolean showCheatSheet,			IProgressMonitor monitor ) throws CoreException	{		// create a sample file		monitor.beginTask( CREATING + fileName, 2 );		IResource resource = (IContainer) ResourcesPlugin.getWorkspace( )				.getRoot( )				.findMember( containerName );		IContainer container = null;		if ( resource == null				|| !resource.exists( )				|| !( resource instanceof IContainer ) )		{			// create folder if not exist			IFolder folder = createFolderHandle( containerName );			UIUtil.createFolder( folder, monitor );			container = folder;		}		else		{			container = (IContainer) resource;		}		final IFile file = container.getFile( new Path( fileName ) );		final String cheatId = cheatSheetId;		final boolean showCheat = showCheatSheet;		try		{			if ( file.exists( ) )			{				file.setContents( stream, true, true, monitor );			}			else			{				file.create( stream, true, monitor );			}			stream.close( );		}		catch ( Exception e )		{		}		monitor.worked( 1 );		monitor.setTaskName( OPENING_FILE_FOR_EDITING );		getShell( ).getDisplay( ).asyncExec( new Runnable( ) {			public void run( )			{				IWorkbench workbench = PlatformUI.getWorkbench( );				IWorkbenchWindow window = workbench.getActiveWorkbenchWindow( );				IWorkbenchPage page = window.getActivePage( );				try				{					IEditorPart editorPart = IDE.openEditor( page, file, true );					ModuleHandle model = SessionHandleAdapter.getInstance( )							.getReportDesignHandle( );					if ( ReportPlugin.getDefault( )							.getEnableCommentPreference( ) )					{						model.setStringProperty( ModuleHandle.COMMENTS_PROP,								ReportPlugin.getDefault( )										.getCommentPreference( ) );						model.save( );						editorPart.doSave( null );					}					// setReportSettings( ( (IDEReportEditor) editorPart					// ).getModel( ) );					// editorPart.doSave( null );					BasicNewProjectResourceWizard.updatePerspective( configElement );					if ( showCheat && !cheatId.equals( "" ) ) //$NON-NLS-1$					{						OpenCheatSheetAction action = null;						// Temporary remark the choice page for that feature is						// not supported in R1						// if ( choicePage.isCustom( ) )						// {						// action = new OpenCheatSheetAction( file.getName( ),						// file.getName( ),						// new URL( cheatId ) ); //$NON-NLS-1$						// }						// else						// {						action = new OpenCheatSheetAction( cheatId );						// }						action.run( );					}				}				catch ( Exception e )				{					ExceptionHandler.handle( e );				}			}		} );		monitor.worked( 1 );	}