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(); }