Search in sources :

Example 1 with RepositoryExportProgressDialog

use of org.pentaho.di.ui.repository.dialog.RepositoryExportProgressDialog in project pentaho-kettle by pentaho.

the class Spoon method exportRepositoryDirectory.

/**
 * @param directoryToExport
 *          set to null to export the complete repository
 * @return false if we want to stop processing. true if we need to continue.
 */
public boolean exportRepositoryDirectory(RepositoryDirectory directoryToExport) {
    FileDialog dialog = this.getExportFileDialog();
    if (dialog.open() == null) {
        return false;
    }
    String filename = dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName();
    log.logBasic(BaseMessages.getString(PKG, "Spoon.Log.Exporting"), BaseMessages.getString(PKG, "Spoon.Log.ExportObjectsToFile", filename));
    // check if file is exists
    MessageBox box = RepositoryExportProgressDialog.checkIsFileIsAcceptable(shell, log, filename);
    int answer = (box == null) ? SWT.OK : box.open();
    if (answer != SWT.OK) {
        // seems user don't want to overwrite file...
        return false;
    }
    // ok, let's show one more modal dialog, users like modal dialogs.
    // They feel that their opinion are important to us.
    box = new MessageBox(shell, SWT.ICON_QUESTION | SWT.APPLICATION_MODAL | SWT.SHEET | SWT.YES | SWT.NO | SWT.CANCEL);
    box.setText(BaseMessages.getString(PKG, "Spoon.QuestionApplyImportRulesToExport.Title"));
    box.setMessage(BaseMessages.getString(PKG, "Spoon.QuestionApplyImportRulesToExport.Message"));
    answer = box.open();
    if (answer == SWT.CANCEL) {
        return false;
    }
    // Get the import rules
    // 
    ImportRules importRules = new ImportRules();
    if (answer == SWT.YES) {
        ImportRulesDialog importRulesDialog = new ImportRulesDialog(shell, importRules);
        if (!importRulesDialog.open()) {
            return false;
        }
    }
    RepositoryExportProgressDialog repd = new RepositoryExportProgressDialog(shell, rep, directoryToExport, filename, importRules);
    repd.open();
    return true;
}
Also used : ImportRules(org.pentaho.di.imp.ImportRules) ImportRulesDialog(org.pentaho.di.ui.imp.ImportRulesDialog) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) KettlePropertiesFileDialog(org.pentaho.di.ui.core.dialog.KettlePropertiesFileDialog) FileDialog(org.eclipse.swt.widgets.FileDialog) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) RepositoryExportProgressDialog(org.pentaho.di.ui.repository.dialog.RepositoryExportProgressDialog) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

FileDialog (org.eclipse.swt.widgets.FileDialog)1 MessageBox (org.eclipse.swt.widgets.MessageBox)1 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)1 Point (org.pentaho.di.core.gui.Point)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 ImportRules (org.pentaho.di.imp.ImportRules)1 KettlePropertiesFileDialog (org.pentaho.di.ui.core.dialog.KettlePropertiesFileDialog)1 ImportRulesDialog (org.pentaho.di.ui.imp.ImportRulesDialog)1 RepositoryExportProgressDialog (org.pentaho.di.ui.repository.dialog.RepositoryExportProgressDialog)1