@Override
  public boolean performFinish() {
    final String query = sqlpage.getQueryText();
    final String fileName = reportFileName;
    final String dataSetName = datasetpage.getDataSetNameText();

    IRunnableWithProgress op =
        new IRunnableWithProgress() {
          public void run(IProgressMonitor monitor) throws InvocationTargetException {
            try {
              doFinish(fileName, dataSetName, query, monitor);
            } catch (CoreException e) {
              throw new InvocationTargetException(e);
            } finally {
              monitor.done();
            }
          }
        };
    try {
      getContainer().run(true, false, op);
    } catch (InterruptedException e) {
      return false;
    } catch (InvocationTargetException e) {
      Throwable realException = e.getTargetException();
      MessageDialog.openError(getShell(), "Error", realException.getMessage());
      return false;
    }
    return true;
  }
  private void doFinish(
      String fileName, String dataSetName, String sqlQueryText, IProgressMonitor monitor)
      throws CoreException {
    //		 create a sample file
    monitor.beginTask("Creating " + fileName, 2);
    // IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    getShell()
        .getDisplay()
        .asyncExec(
            new Runnable() {
              public void run() {
                {
                  IWorkbenchPage page =
                      PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                  page.saveEditor(page.getActiveEditor(), false);
                  page.closeEditor(page.getActiveEditor(), true);
                }
              }
            });

    // retrieve the full system path:
    String fullfilename = reportFile.getRawLocation().toOSString();
    // String fullfilename=osfile+"/"+fileName;

    monitor.worked(1);

    monitor.setTaskName("Fetching SQL...");

    queryList = SQLUtility.getBIRTSQLFields(sqlQueryText);
    monitor.worked(2);
    monitor.setTaskName("Generate SQL Data");

    // SQLUtility.saveDataSetDesign(null, null, null);

    MAXIMOReportDesigner birtReport =
        new MAXIMOReportDesigner(fullfilename, fullfilename, sqlQueryText, queryList);

    birtReport.addDataSet(dataSetName);

    // Close Connection
    sqlpage.closeConnection();

    monitor.worked(3);
    monitor.setTaskName("Opening file for editing...");
    getShell()
        .getDisplay()
        .asyncExec(
            new Runnable() {
              public void run() {
                IWorkbenchPage page =
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                try {

                  // page.close();
                  IDE.openEditor(page, reportFile, true);
                } catch (PartInitException e) {
                }
              }
            });
    monitor.worked(4);
  }
 @Override
 public boolean performCancel() {
   sqlpage.closeConnection();
   return super.performCancel();
 }