org.pentaho.di.ui.core.dialog.ErrorDialog Java Examples

The following examples show how to use org.pentaho.di.ui.core.dialog.ErrorDialog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataSetHelper.java    From pentaho-pdi-dataset with Apache License 2.0 6 votes vote down vote up
public void editUnitTest( Spoon spoon, TransMeta transMeta, String unitTestName ) {

    IMetaStore metaStore = spoon.getMetaStore();
    try {
      FactoriesHierarchy hierarchy = getHierarchy();

      TransUnitTest unitTest = hierarchy.getTestFactory().loadElement( unitTestName );
      if ( unitTest == null ) {
        throw new KettleException( BaseMessages.getString( PKG, "DataSetHelper.ErrorEditingUnitTest.Message", unitTestName ) );
      }
      TransUnitTestDialog dialog = new TransUnitTestDialog( spoon.getShell(), transMeta, metaStore, unitTest );
      if ( dialog.open() ) {
        saveUnitTest( hierarchy.getTestFactory(), unitTest, transMeta );
      }
    } catch ( Exception exception ) {
      new ErrorDialog( Spoon.getInstance().getShell(),
        BaseMessages.getString( PKG, "DataSetHelper.ErrorEditingUnitTest.Title" ),
        BaseMessages.getString( PKG, "DataSetHelper.ErrorEditingUnitTest.Message", unitTestName ),
        exception );
    }
  }
 
Example #2
Source File: PGBulkLoaderDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void getUpdate() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null ) {
      TableItemInsertListener listener = new TableItemInsertListener() {
        public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
          if ( v.getType() == ValueMetaInterface.TYPE_DATE ) {
            // The default is date mask.
            tableItem.setText( 3, BaseMessages.getString( PKG, "PGBulkLoaderDialog.DateMask.Label" ) );
          } else {
            tableItem.setText( 3, "" );
          }
          return true;
        }
      };
      BaseStepDialog.getFieldsFromPrevious( r, wReturn, 1, new int[] { 1, 2 }, new int[] {}, -1, -1, listener );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog(
      shell, BaseMessages.getString( PKG, "PGBulkLoaderDialog.FailedToGetFields.DialogTitle" ), BaseMessages
        .getString( PKG, "PGBulkLoaderDialog.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example #3
Source File: Neo4jPerspective.java    From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 6 votes vote down vote up
private void editConnection( Event event ) {
  String[] selection = wConnections.getSelection();
  if ( selection == null || selection.length < 1 ) {
    return;
  }
  String connectionName = selection[ 0 ];

  try {
    NeoConnectionUtils.editConnection(
      Spoon.getInstance().getShell(),
      getVariableSpace(),
      connectionFactory,
      connectionName
    );
    updateConnectionsList();
    wConnections.setSelection( new String[] { connectionName } );
  } catch ( Exception e ) {
    new ErrorDialog( Spoon.getInstance().getShell(), "Error", "Unable to edit connection", e );
  }

}
 
Example #4
Source File: DataSetHelper.java    From pentaho-pdi-dataset with Apache License 2.0 6 votes vote down vote up
/**
 * List all unit tests which are defined
 * And allow the user to select one to delete
 */
public void deleteUnitTest() {
  try {

    RowMetaAndData selection = selectUnitTestFromAllTests();
    if ( selection != null ) {
      String unitTestName = selection.getString( 0, null );

      if ( StringUtils.isNotEmpty( unitTestName ) ) {
        deleteUnitTest( unitTestName );
      }
    }
  } catch ( Exception e ) {
    new ErrorDialog( Spoon.getInstance().getShell(), "Error", "Error deleting unit test", e );
  }
}
 
Example #5
Source File: StarModelerPerspective.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void generateSqlJobButton(StarDomain starDomain) {
  final Spoon spoon = Spoon.getInstance();

  List<DatabaseMeta> sharedDatabases = SharedDatabaseUtil.loadSharedDatabases();

  // TODO: validate presence of repository, repository directory
  //
  JobGenerator jobGenerator = new JobGenerator(starDomain, spoon.rep, new RepositoryDirectory(), sharedDatabases, defaultLocale);
  try {
    JobMeta jobMeta = jobGenerator.generateSqlJob();
    spoon.addJobGraph(jobMeta);
    SpoonPerspectiveManager.getInstance().activatePerspective(MainSpoonPerspective.class);
  } catch(Exception e) {
    new ErrorDialog(spoon.getShell(),
        BaseMessages.getString(PKG, "StarModelerPerspective.ErrorGeneratingSqlJob.Title"),
        BaseMessages.getString(PKG, "StarModelerPerspective.ErrorGeneratingSqlJob.Message"), e);

  }


}
 
Example #6
Source File: SetVariableDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void get() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null && !r.isEmpty() ) {
      BaseStepDialog.getFieldsFromPrevious(
        r, wFields, 1, new int[] { 1 }, new int[] {}, -1, -1, new TableItemInsertListener() {
          public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
            tableItem.setText( 2, v.getName().toUpperCase() );
            tableItem.setText( 3, SetVariableMeta
              .getVariableTypeDescription( SetVariableMeta.VARIABLE_TYPE_ROOT_JOB ) );
            return true;
          }
        } );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog(
      shell, BaseMessages.getString( PKG, "SetVariableDialog.FailedToGetFields.DialogTitle" ), BaseMessages
        .getString( PKG, "Set.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example #7
Source File: RepositoryExplorerDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void editCluster( String clusterName ) {
  try {
    ObjectId id = rep.getClusterID( clusterName );
    ClusterSchema cluster = rep.loadClusterSchema( id, rep.getSlaveServers(), null ); // Load the last version

    ClusterSchemaDialog dd = new ClusterSchemaDialog( shell, cluster, rep.getSlaveServers() );
    if ( dd.open() ) {
      rep.insertLogEntry( "Updating cluster '" + cluster.getName() + "'" );
      rep.save( cluster, Const.VERSION_COMMENT_EDIT_VERSION, null );
      if ( !clusterName.equalsIgnoreCase( cluster.getName() ) ) {
        refreshTree();
      }
    }
  } catch ( KettleException e ) {
    //CHECKSTYLE:LineLength:OFF
    new ErrorDialog( shell,
      BaseMessages.getString( PKG, "RepositoryExplorerDialog.Cluster.Edit.UnexpectedError.Title" ),
      BaseMessages.getString( PKG, "RepositoryExplorerDialog.Cluster.Edit.UnexpectedError.Message" ) + clusterName + "]", e );
  }
}
 
Example #8
Source File: BeamHelper.java    From kettle-beam with Apache License 2.0 6 votes vote down vote up
public void exportMetaStore() {
  final Shell shell = Spoon.getInstance().getShell();
  final IMetaStore metaStore = Spoon.getInstance().getMetaStore();
  final String filename = "/tmp/metastore.json";

  try {
    SerializableMetaStore sms = new SerializableMetaStore( metaStore );
    FileOutputStream fos = new FileOutputStream( filename );
    fos.write( sms.toJson().getBytes( "UTF-8" ));
    fos.flush();
    fos.close();

    MessageBox box = new MessageBox( shell, SWT.CLOSE | SWT.ICON_INFORMATION );
    box.setText( "Metastore exported" );
    box.setMessage( "All current metastore entries were exported to "+filename);
    box.open();

  } catch(Exception e) {
    new ErrorDialog( shell, "Error", "Error exporting metastore json", e );
  }

}
 
Example #9
Source File: TransExecutionConfigurationDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void getInfo() {
  try {
    configuration.setReplayDate( null ); // removed from new execution dialog.
    getConfiguration().setRunConfiguration( wRunConfiguration.getText() );

    configuration.setSafeModeEnabled( wSafeMode.getSelection() );
    configuration.setClearingLog( wClearLog.getSelection() );
    configuration.setLogLevel( LogLevel.values()[wLogLevel.getSelectionIndex()] );
    configuration.setGatheringMetrics( wGatherMetrics.getSelection() );

    // The lower part of the dialog...
    getInfoParameters();
    getInfoVariables();
  } catch ( Exception e ) {
    new ErrorDialog( shell, "Error in settings", "There is an error in the dialog settings", e );
  }
}
 
Example #10
Source File: SetValueConstantDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void get() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepMeta );
    if ( r != null ) {
      TableItemInsertListener insertListener = new TableItemInsertListener() {
        public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
          return true;
        }
      };

      BaseStepDialog
        .getFieldsFromPrevious( r, wFields, 1, new int[] { 1 }, new int[] {}, -1, -1, insertListener );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.GetFieldsFailed.Title" ), BaseMessages
      .getString( PKG, "System.Dialog.GetFieldsFailed.Message" ), ke );
  }
}
 
Example #11
Source File: XulDatabaseExplorerController.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void getDDL() {
  if ( model.getTable() == null ) {
    return;
  }
  Database db = new Database( null, this.model.getDatabaseMeta() );
  try {
    db.connect();
    String tableName = getSchemaAndTable( this.model );
    RowMetaInterface r = db.getTableFields( tableName );
    String sql = db.getCreateTableStatement( tableName, r, null, false, null, true );
    SQLEditor se =
      new SQLEditor( this.getDatabaseMeta(), this.dbExplorerDialog.getShell(), SWT.NONE, this.model
        .getDatabaseMeta(), this.dbcache, sql );
    se.open();
  } catch ( KettleDatabaseException dbe ) {
    new ErrorDialog(
      this.dbExplorerDialog.getShell(), BaseMessages.getString( PKG, "Dialog.Error.Header" ), BaseMessages
        .getString( PKG, "DatabaseExplorerDialog.Error.RetrieveLayout" ), dbe );
  } finally {
    db.disconnect();
  }
}
 
Example #12
Source File: TextFileOutputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void getFields() {
  if ( !gotPreviousFields ) {
    try {
      String field = wFileNameField.getText();
      RowMetaInterface r = transMeta.getPrevStepFields( stepname );
      if ( r != null ) {
        wFileNameField.setItems( r.getFieldNames() );
      }
      if ( field != null ) {
        wFileNameField.setText( field );
      }
    } catch ( KettleException ke ) {
      new ErrorDialog(
        shell, BaseMessages.getString( PKG, "TextFileOutputDialog.FailedToGetFields.DialogTitle" ),
        BaseMessages.getString( PKG, "TextFileOutputDialog.FailedToGetFields.DialogMessage" ), ke );
    }
    gotPreviousFields = true;
  }
}
 
Example #13
Source File: Neo4jPerspective.java    From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 6 votes vote down vote up
private void deleteConnection( Event event ) {
  String[] selection = wConnections.getSelection();
  if ( selection == null || selection.length < 1 ) {
    return;
  }
  String connectionName = selection[ 0 ];

  try {
    NeoConnectionUtils.deleteConnection(
      Spoon.getInstance().getShell(),
      connectionFactory,
      connectionName
    );
    updateConnectionsList();
  } catch ( Exception e ) {
    new ErrorDialog( Spoon.getInstance().getShell(), "Error", "Unable to delete connection", e );
  }
}
 
Example #14
Source File: CombinationLookupDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void get() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null && !r.isEmpty() ) {
      BaseStepDialog.getFieldsFromPrevious(
        r, wKey, 1, new int[] { 1, 2 }, new int[] {}, -1, -1, new TableItemInsertListener() {
          public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
            tableItem.setText( 3, "N" );
            return true;
          }
        } );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog( shell, BaseMessages.getString(
      PKG, "CombinationLookupDialog.UnableToGetFieldsError.DialogTitle" ), BaseMessages.getString(
      PKG, "CombinationLookupDialog.UnableToGetFieldsError.DialogMessage" ), ke );
  }
}
 
Example #15
Source File: LDAPOutputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void getUpdate() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null ) {
      TableItemInsertListener listener = new TableItemInsertListener() {
        public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
          tableItem.setText( 3, "Y" );
          return true;
        }
      };
      BaseStepDialog.getFieldsFromPrevious( r, wReturn, 1, new int[] { 1, 2 }, new int[] {}, -1, -1, listener );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog(
      shell, BaseMessages.getString( PKG, "LDAPOutputUpdateDialog.FailedToGetFields.DialogTitle" ),
      BaseMessages.getString( PKG, "LDAPOutputUpdateDialog.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example #16
Source File: JsonInputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setSourceStreamField() {
  try {
    String value = wFieldValue.getText();
    wFieldValue.removeAll();

    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null ) {
      wFieldValue.setItems( r.getFieldNames() );
    }
    if ( value != null ) {
      wFieldValue.setText( value );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog( shell, BaseMessages.getString( PKG, "JsonInputDialog.FailedToGetFields.DialogTitle" ),
        BaseMessages.getString( PKG, "JsonInputDialog.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example #17
Source File: JobLogDelegate.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void addToolBar() {

    try {
      XulLoader loader = new KettleXulLoader();
      loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
      ResourceBundle bundle = new XulSpoonResourceBundle( Spoon.class );
      XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TRANS_LOG_TOOLBAR, bundle );
      xulDomContainer.addEventHandler( this );
      toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" );

      ToolBar swtToolbar = (ToolBar) toolbar.getManagedObject();
      spoon.props.setLook( swtToolbar, Props.WIDGET_STYLE_TOOLBAR );
      swtToolbar.layout( true, true );
    } catch ( Throwable t ) {
      log.logError( Const.getStackTracker( t ) );
      new ErrorDialog( jobLogComposite.getShell(),
        BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ),
        BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_LOG_TOOLBAR ),
        new Exception( t ) );
    }
  }
 
Example #18
Source File: RssOutputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void get( TableView wTable ) {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null ) {
      TableItemInsertListener listener = new TableItemInsertListener() {
        public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
          return true;
        }
      };
      BaseStepDialog.getFieldsFromPrevious( r, wTable, 1, new int[] { 1, 2 }, new int[] {}, -1, -1, listener );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog(
      shell, BaseMessages.getString( PKG, "RssOutputDialog.UnableToGetFieldsError.DialogTitle" ), BaseMessages
        .getString( PKG, "RssOutputDialog.UnableToGetFieldsError.DialogMessage" ), ke );
  }
}
 
Example #19
Source File: RepositoriesHelper.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void editRepository() {
  try {
    PluginInterface plugin = null;
    RepositoryMeta ri = input.searchRepository( model.getSelectedRepository().getName() );
    if ( ri != null ) {
      plugin = PluginRegistry.getInstance().getPlugin( RepositoryPluginType.class, ri.getId() );
      if ( plugin == null ) {
        throw new KettleException( BaseMessages
          .getString( PKG, "RepositoryLogin.ErrorFindingPlugin", ri.getId() ) );
      }
    }
    RepositoryDialogInterface dd = getRepositoryDialog( plugin, ri, input, this.shell );
    if ( dd.open( MODE.EDIT ) != null ) {
      fillRepositories();
      int idx = input.indexOfRepository( ri );
      model.setSelectedRepository( input.getRepository( idx ) );
      writeData();
    }
  } catch ( Exception e ) {
    log.logDetailed( BaseMessages.getString( PKG, "RepositoryLogin.ErrorEditingRepository", e
      .getLocalizedMessage() ) );
    new ErrorDialog( shell, BaseMessages.getString( PKG, "Dialog.Error" ), BaseMessages.getString(
      PKG, "RepositoryLogin.ErrorEditingRepository", e.getLocalizedMessage() ), e );
  }
}
 
Example #20
Source File: WebServiceAvailableDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void get() {
  if ( !gotPreviousFields ) {
    try {
      String filefield = wURL.getText();
      wURL.removeAll();
      RowMetaInterface r = transMeta.getPrevStepFields( stepname );
      if ( r != null ) {
        wURL.setItems( r.getFieldNames() );
      }
      if ( filefield != null ) {
        wURL.setText( filefield );
      }
    } catch ( KettleException ke ) {
      new ErrorDialog( shell,
        BaseMessages.getString( PKG, "WebServiceAvailableDialog.FailedToGetFields.DialogTitle" ),
        BaseMessages.getString( PKG, "WebServiceAvailableDialog.FailedToGetFields.DialogMessage" ), ke );
    }
    gotPreviousFields = true;
  }
}
 
Example #21
Source File: DimensionLookupDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Get the fields from the previous step and use them as "update fields". Only get the the fields which are not yet in
 * use as key, or in the field table. Also ignore technical key, version, fromdate, todate.
 */
private void getUpdate() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null && !r.isEmpty() ) {
      BaseStepDialog.getFieldsFromPrevious(
        r, wUpIns, 2, new int[] { 1, 2 }, new int[] {}, -1, -1, new TableItemInsertListener() {
          public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
            tableItem
              .setText( 3, BaseMessages.getString( PKG, "DimensionLookupDialog.TableItem.Insert.Label" ) );

            int idx = wKey.indexOfString( v.getName(), 2 );
            return idx < 0
              && !v.getName().equalsIgnoreCase( wTk.getText() )
              && !v.getName().equalsIgnoreCase( wVersion.getText() )
              && !v.getName().equalsIgnoreCase( wFromdate.getText() )
              && !v.getName().equalsIgnoreCase( wTodate.getText() );
          }
        } );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog(
      shell, BaseMessages.getString( PKG, "DimensionLookupDialog.FailedToGetFields.DialogTitle" ),
      BaseMessages.getString( PKG, "DimensionLookupDialog.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example #22
Source File: InsertUpdateDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void get() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null ) {
      TableItemInsertListener listener = new TableItemInsertListener() {
        public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
          tableItem.setText( 2, "=" );
          return true;
        }
      };
      BaseStepDialog.getFieldsFromPrevious( r, wKey, 1, new int[] { 1, 3 }, new int[] {}, -1, -1, listener );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog(
      shell, BaseMessages.getString( PKG, "InsertUpdateDialog.FailedToGetFields.DialogTitle" ), BaseMessages
        .getString( PKG, "InsertUpdateDialog.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example #23
Source File: FuzzyMatchDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setLookupField() {
  if ( !gotLookupFields ) {
    String field = wLookupField.getText();
    try {
      wLookupField.removeAll();

      RowMetaInterface r = transMeta.getStepFields( wStep.getText() );
      if ( r != null ) {
        wLookupField.setItems( r.getFieldNames() );
      }
    } catch ( KettleException ke ) {
      new ErrorDialog( shell,
        BaseMessages.getString( PKG, "FuzzyMatchDialog.FailedToGetLookupFields.DialogTitle" ),
        BaseMessages.getString( PKG, "FuzzyMatchDialog.FailedToGetLookupFields.DialogMessage" ), ke );
    }
    if ( field != null ) {
      wLookupField.setText( field );
    }
    gotLookupFields = true;
  }
}
 
Example #24
Source File: DataOverrideHandler.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void explore() {

    Shell parent = getShell();

    DatabaseMeta dbinfo = new DatabaseMeta();
    getInfo( dbinfo );

    try {
      if ( dbinfo.getAccessType() != DatabaseMeta.TYPE_ACCESS_PLUGIN ) {
        DatabaseExplorerDialog ded = new DatabaseExplorerDialog( parent, SWT.NONE, dbinfo, databases, true );
        ded.open();
      } else {
        MessageBox mb = new MessageBox( parent, SWT.OK | SWT.ICON_INFORMATION );
        mb.setText( BaseMessages.getString( PKG, "DatabaseDialog.ExplorerNotImplemented.Title" ) );
        mb.setMessage( BaseMessages.getString( PKG, "DatabaseDialog.ExplorerNotImplemented.Message" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( parent, BaseMessages.getString( PKG, "DatabaseDialog.ErrorParameters.title" ), BaseMessages
        .getString( PKG, "DatabaseDialog.ErrorParameters.description" ), e );
    }
  }
 
Example #25
Source File: SyslogMessageDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void get() {
  if ( !gotPreviousFields ) {
    gotPreviousFields = true;
    try {
      String source = wMessageField.getText();

      wMessageField.removeAll();
      RowMetaInterface r = transMeta.getPrevStepFields( stepname );
      if ( r != null ) {
        wMessageField.setItems( r.getFieldNames() );
        if ( source != null ) {
          wMessageField.setText( source );
        }
      }
    } catch ( KettleException ke ) {
      new ErrorDialog(
        shell, BaseMessages.getString( PKG, "SyslogMessageDialog.FailedToGetFields.DialogTitle" ),
        BaseMessages.getString( PKG, "SyslogMessageDialog.FailedToGetFields.DialogMessage" ), ke );
    }
  }
}
 
Example #26
Source File: SymmetricCryptoTransDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setSecretKeyFieldname() {
  try {
    String field = wSecretKeyField.getText();
    wSecretKeyField.removeAll();

    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null ) {
      wSecretKeyField.setItems( r.getFieldNames() );
    }
    if ( field != null ) {
      wSecretKeyField.setText( field );
    }

  } catch ( KettleException ke ) {
    new ErrorDialog( shell,
      BaseMessages.getString( PKG, "SymmetricCryptoTransDialog.FailedToGetFields.DialogTitle" ),
      BaseMessages.getString( PKG, "SymmetricCryptoTransDialogMod.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example #27
Source File: MonetDBBulkLoaderDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void getUpdate() {
  try {

    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null ) {
      TableItemInsertListener listener = new TableItemInsertListener() {
        public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
          if ( v.getType() == ValueMetaInterface.TYPE_DATE ) {
            // The default is : format is OK for dates, see if this sticks later on...
            //
            tableItem.setText( 3, "Y" );
          } else {
            tableItem.setText( 3, "Y" ); // default is OK too...
          }
          return true;
        }
      };
      BaseStepDialog.getFieldsFromPrevious( r, wReturn, 1, new int[] { 1, 2 }, new int[] {}, -1, -1, listener );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog( shell, BaseMessages
      .getString( PKG, "MonetDBBulkLoaderDialog.FailedToGetFields.DialogTitle" ), BaseMessages.getString(
      PKG, "MonetDBBulkLoaderDialog.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example #28
Source File: ImportRulesDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void addToolBar() {

    try {
      XulLoader loader = new KettleXulLoader();
      loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
      ResourceBundle bundle = new XulSpoonResourceBundle( Spoon.class );
      XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TOOLBAR, bundle );
      xulDomContainer.addEventHandler( this );
      toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "import-rules-toolbar" );

      ToolBar swtToolbar = (ToolBar) toolbar.getManagedObject();
      swtToolbar.layout( true, true );
    } catch ( Throwable t ) {
      LogChannel.GENERAL.logError( Const.getStackTracker( t ) );
      new ErrorDialog( shell,
        BaseMessages.getString( PKG, "ImportRulesDialog.Exception.ErrorReadingXULFile.Title" ),
        BaseMessages.getString( PKG, "ImportRulesDialog.Exception.ErrorReadingXULFile.Message", XUL_FILE_TOOLBAR ),
        new Exception( t ) );
    }
  }
 
Example #29
Source File: SingleThreaderDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void selectRepositoryTrans() {
  RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject( "*.ktr", log );

  try {
    if ( repositoryObject != null ) {
      loadRepositoryTrans( repositoryObject.getName(), repositoryObject.getRepositoryDirectory() );
      String path = DialogUtils
        .getPath( transMeta.getRepositoryDirectory().getPath(), mappingTransMeta.getRepositoryDirectory().getPath() );
      String fullPath = ( path.equals( "/" ) ? "/" : path + "/" ) + mappingTransMeta.getName();
      wPath.setText( fullPath );
      specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME;
    }
  } catch ( KettleException ke ) {
    new ErrorDialog( shell,
      BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogTitle" ),
      BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogMessage" ), ke );
  }
}
 
Example #30
Source File: AggregateRowsDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void get() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null && r.size() > 0 ) {
      BaseStepDialog.getFieldsFromPrevious( r, wFields, 1, new int[] { 1, 2 }, new int[] {}, -1, -1, null );
    } else {
      MessageBox mb;
      mb = new MessageBox( shell, SWT.OK | SWT.ICON_INFORMATION );
      mb.setMessage( BaseMessages.getString(
        PKG, "AggregateRowsDialog.CouldNotRetrieveFields.DialogMessage", Const.CR ) );
      mb.setText( BaseMessages.getString( PKG, "AggregateRowsDialog.CouldNotRetrieveFields.DialogTitle" ) );
      mb.open();
    }
  } catch ( KettleException ke ) {
    new ErrorDialog(
      shell, BaseMessages.getString( PKG, "AggregateRowsDialog.GetFieldsFailed.DialogTitle" ), BaseMessages
        .getString( PKG, "AggregateRowsDialog.GetFieldsFailed.DialogMessage" ), ke );
  }
}