Search in sources :

Example 1 with NewSubtransDialog

use of org.pentaho.di.ui.spoon.dialog.NewSubtransDialog in project pentaho-kettle by pentaho.

the class BaseStreamingDialog method createNewSubtrans.

protected void createNewSubtrans() {
    TransMeta newSubTransMeta = createSubTransMeta();
    boolean saved = false;
    String path = null;
    if (spoonInstance.getRepository() != null) {
        try {
            saved = spoonInstance.saveToRepository(newSubTransMeta);
            path = getRepositoryRelativePath(newSubTransMeta.getPathAndName());
        } catch (KettleException e) {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Title"), BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Message"), e);
        }
    } else {
        saved = spoonInstance.saveXMLFile(newSubTransMeta, false);
        if (saved) {
            try {
                path = getRelativePath(KettleVFS.getFileObject(newSubTransMeta.getFilename()).toString());
            } catch (KettleFileException e) {
                new ErrorDialog(shell, BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Title"), BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Message"), e);
            }
        }
    }
    if (saved && null != path) {
        wTransPath.setText(path);
        createSubtrans(newSubTransMeta);
        if (props.showNewSubtransPopup()) {
            NewSubtransDialog newSubtransDialog = new NewSubtransDialog(shell, SWT.NONE);
            props.setShowNewSubtransPopup(!newSubtransDialog.open());
        }
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) KettleFileException(org.pentaho.di.core.exception.KettleFileException) TransMeta(org.pentaho.di.trans.TransMeta) NewSubtransDialog(org.pentaho.di.ui.spoon.dialog.NewSubtransDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog)

Aggregations

KettleException (org.pentaho.di.core.exception.KettleException)1 KettleFileException (org.pentaho.di.core.exception.KettleFileException)1 TransMeta (org.pentaho.di.trans.TransMeta)1 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)1 NewSubtransDialog (org.pentaho.di.ui.spoon.dialog.NewSubtransDialog)1