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 ); }
IDE.openEditor( page, file, true );
	private void doFinish( IPath containerName, String fileName,			InputStream stream, 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 ) );		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 );					}					// page.openEditor( new FileEditorInput( file ),					// LibraryReportEditor.EDITOR_ID,					// true );				}				catch ( Exception e )				{					ExceptionHandler.handle( e );				}			}		} );		monitor.worked( 1 );		fireLibraryChanged( fileName );	}