List of usage examples for org.eclipse.jface.dialogs ProgressMonitorDialog run
@Override public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException
IRunnableWithProgress
using the progress monitor for this progress dialog and blocks until the runnable has been run, regardless of the value of fork
. From source file:application.e4.handlers.SaveHandler.java
License:Open Source License
@Execute public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell, @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution) throws InvocationTargetException, InterruptedException { final IEclipseContext pmContext = context.createChild(); ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); dialog.open();/*from w w w. j a v a 2s. c o m*/ dialog.run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { pmContext.set(IProgressMonitor.class.getName(), monitor); if (contribution != null) { Object clientObject = contribution.getObject(); // ContextInjectionFactory.invoke(clientObject, Persist.class, //$NON-NLS-1$ // pmContext, null); } } }); pmContext.dispose(); }
From source file:ariba.ideplugin.eclipse.wizards.AWNewProjectWizard.java
License:Apache License
public boolean performFinish() { String msg = _page2.validate(); if (msg != null) { Status status = new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), 0, msg, null);/*from ww w .ja v a 2 s .c o m*/ ErrorDialog.openError(getShell(), null, null, status); return false; } CreateProject cproj = new CreateProject(getShell(), _connector, _page2.getProjectName(), (File) _page1.getSelectedTemplate().get(AWScriptRunner.TemplateDirKey), _page2.getParameterMap()); ProgressMonitorDialog pmd = new ProgressMonitorDialog(getShell()); try { pmd.run(true, false, cproj); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; }
From source file:at.bitandart.zoubek.mervin.handlers.SaveReview.java
License:Open Source License
@SuppressWarnings("restriction") @Execute//from w w w .j a va 2s . c o m public void execute(final Shell shell, final IReviewRepositoryService repoService, final @Named(IMervinContextConstants.ACTIVE_MODEL_REVIEW) ModelReview modelReview, final User reviewer) { ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(shell); try { progressMonitorDialog.run(true, false, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { repoService.saveReview(new URI(modelReview.getRepositoryURI()), modelReview, reviewer, monitor); } catch (RepositoryIOException e) { logger.error(e, MessageFormat.format( "IO Error while saving the review with id \"{0}\" to repository \"{1}\"", modelReview.getId(), modelReview.getRepositoryURI())); MessageDialog.openError(shell, "Repository IO Error", "An IO error occured while saving the review. Make sure the originating repository is available and writeable. See error log for details."); } catch (InvalidReviewRepositoryException e) { logger.error(e, MessageFormat.format( "Invalid review repository detected while saving the review with id \"{0}\" to repository \"{1}\"", modelReview.getId(), modelReview.getRepositoryURI())); MessageDialog.openError(shell, "Invalid Repository", "The repository URI points to an invalid repository. Make sure the originating repository is available and writeable. See error log for details."); } catch (InvalidReviewException e) { logger.error(e, MessageFormat.format( "Invalid review detected while saving the review with id \"{0}\" to repository \"{1}\"", modelReview.getId(), modelReview.getRepositoryURI())); MessageDialog.openError(shell, "Invalid Review", "The current review is invalid:\n" + e.getMessage()); } catch (URISyntaxException e) { logger.error(e, MessageFormat.format( "Invalid URI detected while saving the review with id \"{0}\" to repository \"{1}\"", modelReview.getId(), modelReview.getRepositoryURI())); MessageDialog.openError(shell, "Invalid URI", MessageFormat.format("The URI \"{0}\" is invalid. See error log for details.", modelReview.getRepositoryURI())); } } }); } catch (InvocationTargetException | InterruptedException e) { logger.error(e, MessageFormat.format("Error while saving the review with id \"{0}\" to repository \"{1}\"", modelReview.getId(), modelReview.getRepositoryURI())); MessageDialog.openError(shell, "Unexpected Error", "An unexpected error occured while saving the review. See error log for details."); } }
From source file:at.bitandart.zoubek.mervin.review.ReviewOptionsView.java
License:Open Source License
/** * updates the selected model comparison of the current model review. *//*from w w w .j ava 2 s . c o m*/ private void udpateSelectedComparison() { ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(shell); try { progressMonitorDialog.run(true, false, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { ModelReview modelReview = getCurrentModelReview(); diffService.updateSelectedComparison(modelReview, monitor); monitor.done(); } }); } catch (InvocationTargetException | InterruptedException e) { logger.error(e, "Could not udapte the selected comparison"); } }
From source file:at.bitandart.zoubek.mervin.review.wizards.ReviewSelectionPage.java
License:Open Source License
@SuppressWarnings("restriction") private void loadChanges(final String uri) { try {/*from ww w .j a v a2s. c om*/ ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(getShell()); progressMonitorDialog.run(true, true, new ReviewListUpdater(uri)); } catch (InvocationTargetException | InterruptedException e) { logger.error(e); uiSync.syncExec(new Runnable() { @Override public void run() { MessageDialog.openError(getShell(), "Review list retrieval error", "Could not load all review for this repository. " + "Make sure the repository remote \"origin\" points at the correct " + "accessible remote gerrit repository. " + "See the error log for more details."); } }); } }
From source file:at.medevit.ch.artikelstamm.elexis.common.ui.provider.atccache.ATCCodeCache.java
License:Open Source License
@SuppressWarnings("unchecked") private static void deserializeFromDatabase(String id) throws IOException, ClassNotFoundException { NamedBlob2 cacheStorage = NamedBlob2.load(id); if (cacheStorage != null) { ByteArrayInputStream ba = new ByteArrayInputStream(cacheStorage.getBytes()); ObjectInputStream oba = new ObjectInputStream(ba); cache = (HashMap<String, Integer>) oba.readObject(); oba.close();//from ww w. j a v a2s . c o m ba.close(); } else { ProgressMonitorDialog pmd = new ProgressMonitorDialog(UiDesk.getTopShell()); try { pmd.run(false, false, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { rebuildCache(monitor); } }); } catch (InvocationTargetException | InterruptedException e) { e.printStackTrace(); } } }
From source file:au.gov.ga.earthsci.application.handlers.SaveHandler.java
License:Apache License
@Execute public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell, @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution) throws InvocationTargetException, InterruptedException { final IEclipseContext pmContext = context.createChild(); ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); dialog.open();//from w ww. j a va 2s . co m dialog.run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { pmContext.set(IProgressMonitor.class.getName(), monitor); if (contribution != null) { //Object clientObject = contribution.getObject(); //ContextInjectionFactory.invoke(clientObject, Persist.class, pmContext, null); } } }); pmContext.dispose(); }
From source file:au.gov.ga.earthsci.layer.FileLoader.java
License:Apache License
protected static Document importDataFromFile(Shell parent, final File file, final FileStore fileStore) throws Exception { // Create a DataStoreProducer which is capable of processing the file. final DataStoreProducer producer = createDataStoreProducerFromFile(file); if (producer == null) { throw new IllegalArgumentException("Unrecognized file type"); }//from ww w. jav a 2 s .c o m final AtomicInteger progress = new AtomicInteger(0); PropertyChangeListener progressListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(AVKey.PROGRESS)) { progress.set((int) (100 * (Double) evt.getNewValue())); } } }; producer.addPropertyChangeListener(progressListener); final AtomicBoolean close = new AtomicBoolean(false); final ProgressMonitorDialog dialog = new ProgressMonitorDialog(parent); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { dialog.run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Importing " + file.getName(), 100); while (true) { if (close.get()) { break; } if (monitor.isCanceled()) { producer.stopProduction(); break; } int monitorProgress = 0; int currentProgress = progress.get(); int diff = currentProgress - monitorProgress; if (diff > 0) { monitor.worked(diff); } Thread.sleep(100); } } }); } catch (InvocationTargetException e) { } catch (InterruptedException e) { producer.stopProduction(); } } }); Document doc = null; try { // Import the file into the specified FileStore. doc = createDataStoreFromFile(file, fileStore, producer); // The user clicked the ProgressMonitor's "Cancel" button. Revert any change made during production, and // discard the returned DataConfiguration reference. if (dialog.getReturnCode() == Dialog.CANCEL) { doc = null; producer.removeProductionState(); } } finally { // Remove the progress event listener from the DataStoreProducer. stop the progress timer, and signify to the // ProgressMonitor that we're done. close.set(true); producer.removePropertyChangeListener(progressListener); } return doc; }
From source file:be.ibridge.kettle.chef.Chef.java
License:LGPL
public boolean ripDB(String jobName, RepositoryDirectory repositoryDirectory, final DatabaseMeta srcDbInfo, final DatabaseMeta tgtDbInfo, String[] tablesToRip) { final String[] tables = tablesToRip; final DatabaseMeta sourceDbInfo = srcDbInfo; final DatabaseMeta targetDbInfo = tgtDbInfo; final RepositoryDirectory repdir = repositoryDirectory; final String jobname = jobName; ////from w ww. j a v a 2 s . co m // Create a new job... // jobMeta = new JobMeta(log); try { jobMeta.readDatabases(rep); } catch (KettleException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } setFilename(null); jobMeta.setName(jobname); jobMeta.setDirectory(repdir); refreshTree(); refreshGraph(); final Point location = new Point(50, 50); // The start entry... final JobEntryCopy start = jobMeta.findStart(); start.setLocation(new Point(location.x, location.y)); start.setDrawn(); // final Thread parentThread = Thread.currentThread(); // Create a dialog with a progress indicator! IRunnableWithProgress op = new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { // This is running in a new process: copy some KettleVariables info // LocalVariables.getInstance().createKettleVariables(Thread.currentThread().getName(), parentThread.getName(), true); monitor.beginTask(Messages.getString("Spoon.RipDB.Monitor.BuildingNewJob"), tables.length); //$NON-NLS-1$ monitor.worked(0); JobEntryCopy previous = start; // Loop over the table-names... for (int i = 0; i < tables.length && !monitor.isCanceled(); i++) { monitor.setTaskName( Messages.getString("Spoon.RipDB.Monitor.ProcessingTable") + tables[i] + "]..."); //$NON-NLS-1$ //$NON-NLS-2$ // // Create the new transformation... // String transname = Messages.getString("Spoon.RipDB.Monitor.Transname1") + sourceDbInfo + "].[" //$NON-NLS-1$//$NON-NLS-2$ + tables[i] + Messages.getString("Spoon.RipDB.Monitor.Transname2") + targetDbInfo + "]"; //$NON-NLS-1$ //$NON-NLS-2$ TransMeta ti = new TransMeta((String) null, transname, null); ti.setDirectory(repdir); // // Add a note // String note = Messages.getString("Spoon.RipDB.Monitor.Note1") + tables[i] //$NON-NLS-1$ + Messages.getString("Spoon.RipDB.Monitor.Note2") + sourceDbInfo + "]" + Const.CR; //$NON-NLS-1$ //$NON-NLS-2$ note += Messages.getString("Spoon.RipDB.Monitor.Note3") + tables[i] //$NON-NLS-1$ + Messages.getString("Spoon.RipDB.Monitor.Note4") + targetDbInfo + "]"; //$NON-NLS-1$ //$NON-NLS-2$ NotePadMeta ni = new NotePadMeta(note, 150, 10, -1, -1); ti.addNote(ni); // // Add the TableInputMeta step... // String fromstepname = Messages.getString("Spoon.RipDB.Monitor.FromStep.Name") + tables[i] + "]"; //$NON-NLS-1$ //$NON-NLS-2$ TableInputMeta tii = new TableInputMeta(); tii.setDatabaseMeta(sourceDbInfo); tii.setSQL("SELECT * FROM " + srcDbInfo.quoteField(tables[i])); //$NON-NLS-1$ String fromstepid = StepLoader.getInstance().getStepPluginID(tii); StepMeta fromstep = new StepMeta(fromstepid, fromstepname, tii); fromstep.setLocation(150, 100); fromstep.setDraw(true); fromstep.setDescription(Messages.getString("Spoon.RipDB.Monitor.FromStep.Description") //$NON-NLS-1$ + tables[i] + Messages.getString("Spoon.RipDB.Monitor.FromStep.Description2") //$NON-NLS-1$ + sourceDbInfo + "]"); //$NON-NLS-1$ ti.addStep(fromstep); // // Add the TableOutputMeta step... // String tostepname = Messages.getString("Spoon.RipDB.Monitor.ToStep.Name") + tables[i] + "]"; //$NON-NLS-1$ //$NON-NLS-2$ TableOutputMeta toi = new TableOutputMeta(); toi.setDatabaseMeta(targetDbInfo); toi.setTablename(tables[i]); toi.setCommitSize(100); toi.setTruncateTable(true); String tostepid = StepLoader.getInstance().getStepPluginID(toi); StepMeta tostep = new StepMeta(tostepid, tostepname, toi); tostep.setLocation(500, 100); tostep.setDraw(true); tostep.setDescription(Messages.getString("Spoon.RipDB.Monitor.ToStep.Description1") + tables[i] //$NON-NLS-1$ + Messages.getString("Spoon.RipDB.Monitor.ToStep.Description2") + targetDbInfo + "]"); //$NON-NLS-1$ //$NON-NLS-2$ ti.addStep(tostep); // // Add a hop between the two steps... // TransHopMeta hi = new TransHopMeta(fromstep, tostep); ti.addTransHop(hi); // // Now we generate the SQL needed to run for this transformation. // // First set the limit to 1 to speed things up! String tmpSql = tii.getSQL(); tii.setSQL(tii.getSQL() + sourceDbInfo.getLimitClause(1)); String sql = ""; //$NON-NLS-1$ try { sql = ti.getSQLStatementsString(); } catch (KettleStepException kse) { throw new InvocationTargetException(kse, Messages.getString("Spoon.RipDB.Exception.ErrorGettingSQLFromTransformation") + ti //$NON-NLS-1$ + "] : " + kse.getMessage()); //$NON-NLS-1$ } // remove the limit tii.setSQL(tmpSql); // // Now, save the transformation... // try { ti.saveRep(rep); } catch (KettleException dbe) { throw new InvocationTargetException(dbe, Messages.getString("Spoon.RipDB.Exception.UnableToSaveTransformationToRepository")); //$NON-NLS-1$ } // We can now continue with the population of the job... //////////////////////////////////////////////////////////////////////// location.x = 250; if (i > 0) location.y += 100; // // We can continue defining the job. // // First the SQL, but only if needed! // If the table exists & has the correct format, nothing is done // if (sql != null && sql.length() > 0) { String jesqlname = Messages.getString("Spoon.RipDB.JobEntrySQL.Name") + tables[i] + "]"; //$NON-NLS-1$ //$NON-NLS-2$ JobEntrySQL jesql = new JobEntrySQL(jesqlname); jesql.setDatabase(targetDbInfo); jesql.setSQL(sql); jesql.setDescription(Messages.getString("Spoon.RipDB.JobEntrySQL.Description") //$NON-NLS-1$ + targetDbInfo + "].[" + tables[i] + "]"); //$NON-NLS-1$ //$NON-NLS-2$ JobEntryCopy jecsql = new JobEntryCopy(); jecsql.setEntry(jesql); jecsql.setLocation(new Point(location.x, location.y)); jecsql.setDrawn(); jobMeta.addJobEntry(jecsql); // Add the hop too... JobHopMeta jhi = new JobHopMeta(previous, jecsql); jobMeta.addJobHop(jhi); previous = jecsql; } // // Add the jobentry for the transformation too... // String jetransname = Messages.getString("Spoon.RipDB.JobEntryTrans.Name") + tables[i] + "]"; //$NON-NLS-1$ //$NON-NLS-2$ JobEntryTrans jetrans = new JobEntryTrans(jetransname); jetrans.setTransname(ti.getName()); jetrans.setDirectory(ti.getDirectory()); JobEntryCopy jectrans = new JobEntryCopy(log, jetrans); jectrans.setDescription(Messages.getString("Spoon.RipDB.JobEntryTrans.Description1") + Const.CR //$NON-NLS-1$ + Messages.getString("Spoon.RipDB.JobEntryTrans.Description2") + sourceDbInfo + "].[" //$NON-NLS-1$//$NON-NLS-2$ + tables[i] + "]" + Const.CR //$NON-NLS-1$ + Messages.getString("Spoon.RipDB.JobEntryTrans.Description3") + targetDbInfo + "].[" //$NON-NLS-1$//$NON-NLS-2$ + tables[i] + "]"); //$NON-NLS-1$ jectrans.setDrawn(); location.x += 400; jectrans.setLocation(new Point(location.x, location.y)); jobMeta.addJobEntry(jectrans); // Add a hop between the last 2 job entries. JobHopMeta jhi2 = new JobHopMeta(previous, jectrans); jobMeta.addJobHop(jhi2); previous = jectrans; monitor.worked(1); } monitor.worked(100); monitor.done(); } }; try { ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell); pmd.run(false, true, op); } catch (InvocationTargetException e) { new ErrorDialog(shell, Messages.getString("Spoon.ErrorDialog.RipDB.ErrorRippingTheDatabase.Title"), //$NON-NLS-1$ Messages.getString("Chef.ErrorDialog.RipDB.ErrorRippingTheDatabase.Message"), e); //$NON-NLS-1$ return false; } catch (InterruptedException e) { new ErrorDialog(shell, Messages.getString("Spoon.ErrorDialog.RipDB.ErrorRippingTheDatabase.Title"), //$NON-NLS-1$ Messages.getString("Chef.ErrorDialog.RipDB.ErrorRippingTheDatabase.Message"), e); //$NON-NLS-1$ return false; } finally { refreshGraph(); refreshTree(); } return true; }
From source file:be.ibridge.kettle.spoon.Spoon.java
License:LGPL
public JobMeta ripDB(final ArrayList databases, final String jobname, final RepositoryDirectory repdir, final String directory, final DatabaseMeta sourceDbInfo, final DatabaseMeta targetDbInfo, final String[] tables) { ////w w w . j av a 2 s.c o m // Create a new job... // final JobMeta jobMeta = new JobMeta(log); jobMeta.setDatabases(databases); jobMeta.setFilename(null); jobMeta.setName(jobname); if (rep != null) { jobMeta.setDirectory(repdir); } else { jobMeta.setFilename(Const.createFilename(directory, jobname, Const.STRING_JOB_DEFAULT_EXT)); } refreshTree(); refreshGraph(); final Point location = new Point(50, 50); // The start entry... final JobEntryCopy start = JobMeta.createStartEntry(); start.setLocation(new Point(location.x, location.y)); start.setDrawn(); jobMeta.addJobEntry(start); // final Thread parentThread = Thread.currentThread(); // Create a dialog with a progress indicator! IRunnableWithProgress op = new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { // This is running in a new process: copy some KettleVariables info // LocalVariables.getInstance().createKettleVariables(Thread.currentThread().getName(), // parentThread.getName(), true); monitor.beginTask(Messages.getString("Spoon.RipDB.Monitor.BuildingNewJob"), tables.length); //$NON-NLS-1$ monitor.worked(0); JobEntryCopy previous = start; // Loop over the table-names... for (int i = 0; i < tables.length && !monitor.isCanceled(); i++) { monitor.setTaskName( Messages.getString("Spoon.RipDB.Monitor.ProcessingTable") + tables[i] + "]..."); //$NON-NLS-1$ //$NON-NLS-2$ // // Create the new transformation... // String transname = Messages.getString("Spoon.RipDB.Monitor.Transname1") + sourceDbInfo + "].[" //$NON-NLS-1$//$NON-NLS-2$ + tables[i] + Messages.getString("Spoon.RipDB.Monitor.Transname2") + targetDbInfo + "]"; //$NON-NLS-1$ //$NON-NLS-2$ TransMeta transMeta = new TransMeta((String) null, transname, null); if (repdir != null) { transMeta.setDirectory(repdir); } else { transMeta.setFilename( Const.createFilename(directory, transname, Const.STRING_TRANS_DEFAULT_EXT)); } // // Add a note // String note = Messages.getString("Spoon.RipDB.Monitor.Note1") + tables[i] //$NON-NLS-1$ + Messages.getString("Spoon.RipDB.Monitor.Note2") + sourceDbInfo + "]" + Const.CR; //$NON-NLS-1$ //$NON-NLS-2$ note += Messages.getString("Spoon.RipDB.Monitor.Note3") + tables[i] //$NON-NLS-1$ + Messages.getString("Spoon.RipDB.Monitor.Note4") + targetDbInfo + "]"; //$NON-NLS-1$ //$NON-NLS-2$ NotePadMeta ni = new NotePadMeta(note, 150, 10, -1, -1); transMeta.addNote(ni); // // Add the TableInputMeta step... // String fromstepname = Messages.getString("Spoon.RipDB.Monitor.FromStep.Name") + tables[i] + "]"; //$NON-NLS-1$ //$NON-NLS-2$ TableInputMeta tii = new TableInputMeta(); tii.setDatabaseMeta(sourceDbInfo); tii.setSQL("SELECT * FROM " + sourceDbInfo.quoteField(tables[i])); //$NON-NLS-1$ String fromstepid = StepLoader.getInstance().getStepPluginID(tii); StepMeta fromstep = new StepMeta(fromstepid, fromstepname, tii); fromstep.setLocation(150, 100); fromstep.setDraw(true); fromstep.setDescription(Messages.getString("Spoon.RipDB.Monitor.FromStep.Description") //$NON-NLS-1$ + tables[i] + Messages.getString("Spoon.RipDB.Monitor.FromStep.Description2") //$NON-NLS-1$ + sourceDbInfo + "]"); //$NON-NLS-1$ transMeta.addStep(fromstep); // // Add the TableOutputMeta step... // String tostepname = Messages.getString("Spoon.RipDB.Monitor.ToStep.Name") + tables[i] + "]"; //$NON-NLS-1$ //$NON-NLS-2$ TableOutputMeta toi = new TableOutputMeta(); toi.setDatabaseMeta(targetDbInfo); toi.setTablename(tables[i]); toi.setCommitSize(100); toi.setTruncateTable(true); String tostepid = StepLoader.getInstance().getStepPluginID(toi); StepMeta tostep = new StepMeta(tostepid, tostepname, toi); tostep.setLocation(500, 100); tostep.setDraw(true); tostep.setDescription(Messages.getString("Spoon.RipDB.Monitor.ToStep.Description1") + tables[i] //$NON-NLS-1$ + Messages.getString("Spoon.RipDB.Monitor.ToStep.Description2") + targetDbInfo + "]"); //$NON-NLS-1$ //$NON-NLS-2$ transMeta.addStep(tostep); // // Add a hop between the two steps... // TransHopMeta hi = new TransHopMeta(fromstep, tostep); transMeta.addTransHop(hi); // // Now we generate the SQL needed to run for this transformation. // // First set the limit to 1 to speed things up! String tmpSql = tii.getSQL(); tii.setSQL(tii.getSQL() + sourceDbInfo.getLimitClause(1)); String sql = ""; //$NON-NLS-1$ try { sql = transMeta.getSQLStatementsString(); } catch (KettleStepException kse) { throw new InvocationTargetException(kse, Messages.getString("Spoon.RipDB.Exception.ErrorGettingSQLFromTransformation") //$NON-NLS-1$ + transMeta + "] : " + kse.getMessage()); //$NON-NLS-1$ } // remove the limit tii.setSQL(tmpSql); // // Now, save the transformation... // boolean ok; if (rep != null) { ok = saveTransRepository(transMeta); } else { ok = saveTransFile(transMeta); } if (!ok) { throw new InvocationTargetException( new Exception(Messages .getString("Spoon.RipDB.Exception.UnableToSaveTransformationToRepository")), //$NON-NLS-1$ Messages.getString("Spoon.RipDB.Exception.UnableToSaveTransformationToRepository")); } // We can now continue with the population of the job... // ////////////////////////////////////////////////////////////////////// location.x = 250; if (i > 0) location.y += 100; // // We can continue defining the job. // // First the SQL, but only if needed! // If the table exists & has the correct format, nothing is done // if (!Const.isEmpty(sql)) { String jesqlname = Messages.getString("Spoon.RipDB.JobEntrySQL.Name") + tables[i] + "]"; //$NON-NLS-1$ //$NON-NLS-2$ JobEntrySQL jesql = new JobEntrySQL(jesqlname); jesql.setDatabase(targetDbInfo); jesql.setSQL(sql); jesql.setDescription(Messages.getString("Spoon.RipDB.JobEntrySQL.Description") //$NON-NLS-1$ + targetDbInfo + "].[" + tables[i] + "]"); //$NON-NLS-1$ //$NON-NLS-2$ JobEntryCopy jecsql = new JobEntryCopy(); jecsql.setEntry(jesql); jecsql.setLocation(new Point(location.x, location.y)); jecsql.setDrawn(); jobMeta.addJobEntry(jecsql); // Add the hop too... JobHopMeta jhi = new JobHopMeta(previous, jecsql); jobMeta.addJobHop(jhi); previous = jecsql; } // // Add the jobentry for the transformation too... // String jetransname = Messages.getString("Spoon.RipDB.JobEntryTrans.Name") + tables[i] + "]"; //$NON-NLS-1$ //$NON-NLS-2$ JobEntryTrans jetrans = new JobEntryTrans(jetransname); jetrans.setTransname(transMeta.getName()); if (rep != null) { jetrans.setDirectory(transMeta.getDirectory()); } else { jetrans.setFileName( Const.createFilename("${" + Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY + "}", transMeta.getName(), Const.STRING_TRANS_DEFAULT_EXT)); } JobEntryCopy jectrans = new JobEntryCopy(log, jetrans); jectrans.setDescription(Messages.getString("Spoon.RipDB.JobEntryTrans.Description1") + Const.CR //$NON-NLS-1$ + Messages.getString("Spoon.RipDB.JobEntryTrans.Description2") + sourceDbInfo + "].[" //$NON-NLS-1$//$NON-NLS-2$ + tables[i] + "]" + Const.CR //$NON-NLS-1$ + Messages.getString("Spoon.RipDB.JobEntryTrans.Description3") + targetDbInfo + "].[" //$NON-NLS-1$//$NON-NLS-2$ + tables[i] + "]"); //$NON-NLS-1$ jectrans.setDrawn(); location.x += 400; jectrans.setLocation(new Point(location.x, location.y)); jobMeta.addJobEntry(jectrans); // Add a hop between the last 2 job entries. JobHopMeta jhi2 = new JobHopMeta(previous, jectrans); jobMeta.addJobHop(jhi2); previous = jectrans; monitor.worked(1); } monitor.worked(100); monitor.done(); } }; try { ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell); pmd.run(false, true, op); } catch (InvocationTargetException e) { new ErrorDialog(shell, Messages.getString("Spoon.ErrorDialog.RipDB.ErrorRippingTheDatabase.Title"), //$NON-NLS-1$ Messages.getString("Spoon.ErrorDialog.RipDB.ErrorRippingTheDatabase.Message"), e); //$NON-NLS-1$ return null; } catch (InterruptedException e) { new ErrorDialog(shell, Messages.getString("Spoon.ErrorDialog.RipDB.ErrorRippingTheDatabase.Title"), //$NON-NLS-1$ Messages.getString("Spoon.ErrorDialog.RipDB.ErrorRippingTheDatabase.Message"), e); //$NON-NLS-1$ return null; } finally { refreshGraph(); refreshTree(); } return jobMeta; }