コード例 #1
0
    public void actionPerformed(final ActionEvent e) {
      final KettleQueryEntry kettleQueryEntry = (KettleQueryEntry) queryNameList.getSelectedValue();
      final KettleTransFromFileProducer fileProducer = kettleQueryEntry.createProducer();
      final KettleDataFactory dataFactory = new KettleDataFactory();
      dataFactory.setQuery(kettleQueryEntry.getName(), fileProducer);

      try {
        DataFactoryEditorSupport.configureDataFactoryForPreview(dataFactory, designTimeContext);

        final DataPreviewDialog previewDialog = new DataPreviewDialog(KettleDataSourceDialog.this);

        final KettlePreviewWorker worker =
            new KettlePreviewWorker(dataFactory, kettleQueryEntry.getName());
        previewDialog.showData(worker);

        final ReportDataFactoryException factoryException = worker.getException();
        if (factoryException != null) {
          ExceptionDialog.showExceptionDialog(
              KettleDataSourceDialog.this,
              Messages.getString("KettleDataSourceDialog.PreviewError.Title"),
              Messages.getString("KettleDataSourceDialog.PreviewError.Message"),
              factoryException);
        }
      } catch (Exception ex) {
        ExceptionDialog.showExceptionDialog(
            KettleDataSourceDialog.this,
            Messages.getString("KettleDataSourceDialog.PreviewError.Title"),
            Messages.getString("KettleDataSourceDialog.PreviewError.Message"),
            ex);
      }
    }
コード例 #2
0
    public void actionPerformed(final ActionEvent aEvt) {
      try {
        final ScriptableDataFactory dataFactory = produceFactory();
        DataFactoryEditorSupport.configureDataFactoryForPreview(dataFactory, designTimeContext);
        final DataPreviewDialog previewDialog =
            new DataPreviewDialog(ScriptableDataSourceEditor.this);

        final ScriptablePreviewWorker worker =
            new ScriptablePreviewWorker(dataFactory, queryNameTextField.getText());
        previewDialog.showData(worker);

        final ReportDataFactoryException factoryException = worker.getException();
        if (factoryException != null) {
          ExceptionDialog.showExceptionDialog(
              ScriptableDataSourceEditor.this,
              Messages.getString("ScriptableDataSourceEditor.PreviewError.Title"),
              Messages.getString("ScriptableDataSourceEditor.PreviewError.Message"),
              factoryException);
        }
      } catch (Exception e) {
        ExceptionDialog.showExceptionDialog(
            ScriptableDataSourceEditor.this,
            Messages.getString("ScriptableDataSourceEditor.PreviewError.Title"),
            Messages.getString("ScriptableDataSourceEditor.PreviewError.Message"),
            e);
      }
    }