Search in sources :

Example 1 with EnterTextDialog

use of org.apache.hop.ui.core.dialog.EnterTextDialog in project hop by apache.

the class GraphModelEditor method exportGraphToFile.

private void exportGraphToFile() {
    try {
        String prettyJsonString = getModelJson();
        EnterTextDialog dialog = new EnterTextDialog(getShell(), "Model JSON", "This is the JSON of the graph model", prettyJsonString, true);
        dialog.open();
    } catch (Exception e) {
        new ErrorDialog(getShell(), "ERROR", "Error serializing to JSON", e);
    }
}
Also used : EnterTextDialog(org.apache.hop.ui.core.dialog.EnterTextDialog) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) HopException(org.apache.hop.core.exception.HopException)

Example 2 with EnterTextDialog

use of org.apache.hop.ui.core.dialog.EnterTextDialog in project hop by apache.

the class GraphModelEditor method importGraphFromSolutionsWorkbench.

private void importGraphFromSolutionsWorkbench() {
    try {
        EnterTextDialog dialog = new EnterTextDialog(getShell(), "Solutions Workbench Export", "Paste the Solutions Workbench model export (JSON) below", "{}", true);
        String jsonModelString = dialog.open();
        if (jsonModelString == null) {
            return;
        }
        // The graph model is loaded, replace the one in memory
        // 
        GraphModel importedModel = SolutionsWorkbenchImporter.importFromCwJson(jsonModelString);
        graphModel = SolutionsWorkbenchImporter.changeNamesToLabels(importedModel);
        // Refresh the dialog.
        // 
        setWidgetsContent();
        setChanged();
    } catch (Exception e) {
        new ErrorDialog(getShell(), "ERROR", "Error importing JSON", e);
    }
}
Also used : EnterTextDialog(org.apache.hop.ui.core.dialog.EnterTextDialog) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) HopException(org.apache.hop.core.exception.HopException)

Example 3 with EnterTextDialog

use of org.apache.hop.ui.core.dialog.EnterTextDialog in project hop by apache.

the class DataGridDialog method preview.

/**
 * Preview the data generated by this transform. This generates a pipeline using this transform &
 * a dummy and previews it.
 */
private void preview() {
    // Create the table input reader transform...
    DataGridMeta oneMeta = new DataGridMeta();
    getInfo(oneMeta);
    PipelineMeta previewMeta = PipelinePreviewFactory.generatePreviewPipeline(pipelineMeta.getMetadataProvider(), oneMeta, wTransformName.getText());
    EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "DataGridDialog.EnterPreviewSize.Title"), BaseMessages.getString(PKG, "DataGridDialog.EnterPreviewSize.Message"));
    int previewSize = numberDialog.open();
    if (previewSize > 0) {
        PipelinePreviewProgressDialog progressDialog = new PipelinePreviewProgressDialog(shell, variables, previewMeta, new String[] { wTransformName.getText() }, new int[] { previewSize });
        progressDialog.open();
        Pipeline pipeline = progressDialog.getPipeline();
        String loggingText = progressDialog.getLoggingText();
        if (!progressDialog.isCancelled() && pipeline.getResult() != null && pipeline.getResult().getNrErrors() > 0) {
            EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
            etd.setReadOnly();
            etd.open();
        }
        PreviewRowsDialog prd = new PreviewRowsDialog(shell, variables, SWT.NONE, wTransformName.getText(), progressDialog.getPreviewRowsMeta(wTransformName.getText()), progressDialog.getPreviewRows(wTransformName.getText()), loggingText);
        prd.open();
    }
}
Also used : EnterTextDialog(org.apache.hop.ui.core.dialog.EnterTextDialog) PreviewRowsDialog(org.apache.hop.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.apache.hop.ui.core.dialog.EnterNumberDialog) Point(org.eclipse.swt.graphics.Point) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) PipelinePreviewProgressDialog(org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog) Pipeline(org.apache.hop.pipeline.Pipeline)

Example 4 with EnterTextDialog

use of org.apache.hop.ui.core.dialog.EnterTextDialog in project hop by apache.

the class MetadataInputDialog method preview.

// Preview the data
private void preview() {
    try {
        // Create the Access input transform
        MetadataInputMeta oneMeta = new MetadataInputMeta();
        getInfo(oneMeta);
        PipelineMeta previewMeta = PipelinePreviewFactory.generatePreviewPipeline(metadataProvider, oneMeta, wTransformName.getText());
        // Preview the first 1000 rows...
        // 
        PipelinePreviewProgressDialog progressDialog = new PipelinePreviewProgressDialog(shell, variables, previewMeta, new String[] { wTransformName.getText() }, new int[] { 1000 });
        progressDialog.open();
        if (!progressDialog.isCancelled()) {
            Pipeline pipeline = progressDialog.getPipeline();
            String loggingText = progressDialog.getLoggingText();
            if (pipeline.getResult() != null && pipeline.getResult().getNrErrors() > 0) {
                EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
                etd.setReadOnly();
                etd.open();
            }
            PreviewRowsDialog prd = new PreviewRowsDialog(shell, variables, SWT.NONE, wTransformName.getText(), progressDialog.getPreviewRowsMeta(wTransformName.getText()), progressDialog.getPreviewRows(wTransformName.getText()), loggingText);
            prd.open();
        }
    } catch (HopException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "MetadataInputDialog.ErrorPreviewingData.DialogTitle"), BaseMessages.getString(PKG, "MetadataInputDialog.ErrorPreviewingData.DialogMessage"), e);
    }
}
Also used : HopException(org.apache.hop.core.exception.HopException) EnterTextDialog(org.apache.hop.ui.core.dialog.EnterTextDialog) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) PreviewRowsDialog(org.apache.hop.ui.core.dialog.PreviewRowsDialog) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) PipelinePreviewProgressDialog(org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog) Pipeline(org.apache.hop.pipeline.Pipeline)

Example 5 with EnterTextDialog

use of org.apache.hop.ui.core.dialog.EnterTextDialog in project hop by apache.

the class Translator method saveFiles.

private boolean saveFiles(boolean force) {
    // Check if we hve a last value changed but pending to be considered as such.
    if (!Utils.isEmpty(lastValue)) {
        store.storeValue(selectedLocale, selectedSourceFile, selectedMessagesPackage, selectedKey, lastValue);
        lastValueChanged = false;
        updateToDoList(wTodo.getSelectionIndex());
    }
    lastValue = null;
    java.util.List<BundleFile> changedBundleFiles = store.getChangedBundleFiles();
    if (changedBundleFiles.size() > 0) {
        StringBuilder msg = new StringBuilder();
        for (BundleFile bundleFile : changedBundleFiles) {
            String filename = bundleFile.getFilename();
            msg.append(bundleFile.getFilename());
            if (!new File(filename).exists()) {
                msg.append(" (NEW!)");
            }
            msg.append(Const.CR);
        }
        EnterTextDialog dialog = new EnterTextDialog(shell, BaseMessages.getString(PKG, "i18nDialog.ChangedFiles"), BaseMessages.getString(PKG, "i18nDialog.ChangedMessagesFiles"), msg.toString());
        if (dialog.open() != null || force) {
            try {
                for (BundleFile bundleFile : changedBundleFiles) {
                    bundleFile.write();
                    log.logBasic(BaseMessages.getString(PKG, "i18n.Log.SavedMessagesFile", bundleFile.getFilename()));
                }
            } catch (HopException e) {
                new ErrorDialog(shell, BaseMessages.getString(PKG, "i18n.UnexpectedError"), "There was an error saving the changed messages files:", e);
                return false;
            }
            return true;
        } else {
            return false;
        }
    } else {
        // TODO: disable the button if nothing changed.
        return true;
    }
}
Also used : HopException(org.apache.hop.core.exception.HopException) EnterTextDialog(org.apache.hop.ui.core.dialog.EnterTextDialog) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) File(java.io.File)

Aggregations

EnterTextDialog (org.apache.hop.ui.core.dialog.EnterTextDialog)15 ErrorDialog (org.apache.hop.ui.core.dialog.ErrorDialog)11 HopException (org.apache.hop.core.exception.HopException)8 PreviewRowsDialog (org.apache.hop.ui.core.dialog.PreviewRowsDialog)7 Pipeline (org.apache.hop.pipeline.Pipeline)6 PipelineMeta (org.apache.hop.pipeline.PipelineMeta)6 PipelinePreviewProgressDialog (org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog)6 EnterNumberDialog (org.apache.hop.ui.core.dialog.EnterNumberDialog)3 IRowMeta (org.apache.hop.core.row.IRowMeta)2 Point (org.eclipse.swt.graphics.Point)2 MessageBox (org.eclipse.swt.widgets.MessageBox)2 File (java.io.File)1 Result (org.apache.hop.core.Result)1 Database (org.apache.hop.core.database.Database)1 DatabaseMeta (org.apache.hop.core.database.DatabaseMeta)1 SqlScriptStatement (org.apache.hop.core.database.SqlScriptStatement)1 HopDatabaseException (org.apache.hop.core.exception.HopDatabaseException)1 PluginRegistry (org.apache.hop.core.plugins.PluginRegistry)1 TransformPluginType (org.apache.hop.core.plugins.TransformPluginType)1 IValueMeta (org.apache.hop.core.row.IValueMeta)1