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);
}
}
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);
}
}
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();
}
}
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);
}
}
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;
}
}
Aggregations