@Override public boolean performFinish() { // validate the status output String outputDirName = getFinishPage().getOutputDir(); File statusDir = new File(outputDirName); if (!statusDir.exists() || !statusDir.isDirectory()) { UIUtils.errorMessageBox( getShell(), Labels.getString("LoadWizard.errorValidDirectory")); // $NON-NLS-1$ return false; } // set the files for status output try { getController().setStatusFiles(outputDirName, false, true); getController().saveConfig(); } catch (ProcessInitializationException e) { UIUtils.errorMessageBox(getShell(), e); return false; } int val = UIUtils.warningConfMessageBox(getShell(), getConfirmationText()); if (val != SWT.YES) { return false; } if (!wizardhook_validateFinish()) { return false; } try { ProgressMonitorDialog dlg = new ProgressMonitorDialog(getShell()); dlg.run(true, true, new SWTLoadRunable(getController())); } catch (InvocationTargetException e) { logger.error(Labels.getString("LoadWizard.errorAction"), e); // $NON-NLS-1$ UIUtils.errorMessageBox(getShell(), e.getCause() != null ? e.getCause() : e); return false; } catch (InterruptedException e) { logger.error(Labels.getString("LoadWizard.errorAction"), e); // $NON-NLS-1$ UIUtils.errorMessageBox(getShell(), e.getCause() != null ? e.getCause() : e); return false; } return true; }
@Override public boolean wizardhook_validateFinish() { int button = UIUtils.warningConfMessageBox( getShell(), getLabel("validateFirstLine") // $NON-NLS-1$ + System.getProperty("line.separator") + getLabel("validateSecondLine")); // $NON-NLS-1$ //$NON-NLS-2$ return button == SWT.YES; }
/** * Opens the dialog and returns the input * * @return String */ public String open() { // Create the dialog window Shell shell = new Shell(getParent(), getStyle()); shell.setText(getText()); shell.setImage(UIUtils.getImageRegistry().get("sfdc_icon")); // $NON-NLS-1$ createContents(shell); shell.pack(); shell.open(); Display display = getParent().getDisplay(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } // Return the entered value, or null return input; }