use of org.pentaho.di.ui.core.dialog.EnterTextDialog in project pentaho-kettle by pentaho.
the class XMLInputDialog method preview.
// Preview the data
private void preview() {
try {
// Create the XML input step
XMLInputMeta oneMeta = new XMLInputMeta();
getInfo(oneMeta);
// check if the path is given
if (!checkInputPositionsFilled(oneMeta)) {
return;
}
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "XMLInputDialog.NumberRows.DialogTitle"), BaseMessages.getString(PKG, "XMLInputDialog.NumberRows.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
if (!progressDialog.isCancelled()) {
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (trans.getResult() != null && trans.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, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "XMLInputDialog.ErrorPreviewingData.DialogTitle"), BaseMessages.getString(PKG, "XMLInputDialog.ErrorPreviewingData.DialogMessage"), e);
}
}
use of org.pentaho.di.ui.core.dialog.EnterTextDialog in project pentaho-kettle by pentaho.
the class Spoon method exportAllXMLFile.
/**
* Export this job or transformation including all depending resources to a single zip file.
*/
public void exportAllXMLFile() {
ResourceExportInterface resourceExportInterface = getActiveTransformation();
if (resourceExportInterface == null) {
resourceExportInterface = getActiveJob();
}
if (resourceExportInterface == null) {
// nothing to do here, prevent an NPE
return;
}
//
try {
String zipFilename = null;
while (Utils.isEmpty(zipFilename)) {
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setText(BaseMessages.getString(PKG, "Spoon.ExportResourceSelectZipFile"));
dialog.setFilterExtensions(new String[] { "*.zip;*.ZIP", "*" });
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.ZIPFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
setFilterPath(dialog);
if (dialog.open() != null) {
lastDirOpened = dialog.getFilterPath();
zipFilename = dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName();
FileObject zipFileObject = KettleVFS.getFileObject(zipFilename);
if (zipFileObject.exists()) {
MessageBox box = new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL);
box.setMessage(BaseMessages.getString(PKG, "Spoon.ExportResourceZipFileExists.Message", zipFilename));
box.setText(BaseMessages.getString(PKG, "Spoon.ExportResourceZipFileExists.Title"));
int answer = box.open();
if (answer == SWT.CANCEL) {
return;
}
if (answer == SWT.NO) {
zipFilename = null;
}
}
} else {
return;
}
}
// Export the resources linked to the currently loaded file...
//
TopLevelResource topLevelResource = ResourceUtil.serializeResourceExportInterface(zipFilename, resourceExportInterface, (VariableSpace) resourceExportInterface, rep, metaStore);
String message = ResourceUtil.getExplanation(zipFilename, topLevelResource.getResourceName(), resourceExportInterface);
/*
* // Add the ZIP file as a repository to the repository list... // RepositoriesMeta repositoriesMeta = new
* RepositoriesMeta(); repositoriesMeta.readData();
*
* KettleFileRepositoryMeta fileRepositoryMeta = new KettleFileRepositoryMeta(
* KettleFileRepositoryMeta.REPOSITORY_TYPE_ID, "Export " + baseFileName, "Export to file : " + zipFilename,
* "zip://" + zipFilename + "!"); fileRepositoryMeta.setReadOnly(true); // A ZIP file is read-only int nr = 2;
* String baseName = fileRepositoryMeta.getName(); while
* (repositoriesMeta.findRepository(fileRepositoryMeta.getName()) != null) { fileRepositoryMeta.setName(baseName +
* " " + nr); nr++; }
*
* repositoriesMeta.addRepository(fileRepositoryMeta); repositoriesMeta.writeData();
*/
// Show some information concerning all this work...
EnterTextDialog enterTextDialog = new EnterTextDialog(shell, BaseMessages.getString(PKG, "Spoon.Dialog.ResourceSerialized"), BaseMessages.getString(PKG, "Spoon.Dialog.ResourceSerializedSuccesfully"), message);
enterTextDialog.setReadOnly();
enterTextDialog.open();
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.Error"), BaseMessages.getString(PKG, "Spoon.ErrorExportingFile"), e);
}
}
use of org.pentaho.di.ui.core.dialog.EnterTextDialog in project pentaho-kettle by pentaho.
the class Spoon method exportAllFileRepository.
/**
* Export this job or transformation including all depending resources to a single ZIP file containing a file
* repository.
*/
public void exportAllFileRepository() {
ResourceExportInterface resourceExportInterface = getActiveTransformation();
if (resourceExportInterface == null) {
resourceExportInterface = getActiveJob();
}
if (resourceExportInterface == null) {
// nothing to do here, prevent an NPE
return;
}
//
try {
String zipFilename = null;
while (Utils.isEmpty(zipFilename)) {
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setText(BaseMessages.getString(PKG, "Spoon.ExportResourceSelectZipFile"));
dialog.setFilterExtensions(new String[] { "*.zip;*.ZIP", "*" });
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.ZIPFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
setFilterPath(dialog);
if (dialog.open() != null) {
lastDirOpened = dialog.getFilterPath();
zipFilename = dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName();
FileObject zipFileObject = KettleVFS.getFileObject(zipFilename);
if (zipFileObject.exists()) {
MessageBox box = new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL);
box.setMessage(BaseMessages.getString(PKG, "Spoon.ExportResourceZipFileExists.Message", zipFilename));
box.setText(BaseMessages.getString(PKG, "Spoon.ExportResourceZipFileExists.Title"));
int answer = box.open();
if (answer == SWT.CANCEL) {
return;
}
if (answer == SWT.NO) {
zipFilename = null;
}
}
} else {
return;
}
}
// Export the resources linked to the currently loaded file...
//
TopLevelResource topLevelResource = ResourceUtil.serializeResourceExportInterface(zipFilename, resourceExportInterface, (VariableSpace) resourceExportInterface, rep, metaStore);
String message = ResourceUtil.getExplanation(zipFilename, topLevelResource.getResourceName(), resourceExportInterface);
/*
* // Add the ZIP file as a repository to the repository list... // RepositoriesMeta repositoriesMeta = new
* RepositoriesMeta(); repositoriesMeta.readData();
*
* KettleFileRepositoryMeta fileRepositoryMeta = new KettleFileRepositoryMeta(
* KettleFileRepositoryMeta.REPOSITORY_TYPE_ID, "Export " + baseFileName, "Export to file : " + zipFilename,
* "zip://" + zipFilename + "!"); fileRepositoryMeta.setReadOnly(true); // A ZIP file is read-only int nr = 2;
* String baseName = fileRepositoryMeta.getName(); while
* (repositoriesMeta.findRepository(fileRepositoryMeta.getName()) != null) { fileRepositoryMeta.setName(baseName +
* " " + nr); nr++; }
*
* repositoriesMeta.addRepository(fileRepositoryMeta); repositoriesMeta.writeData();
*/
// Show some information concerning all this work...
//
EnterTextDialog enterTextDialog = new EnterTextDialog(shell, BaseMessages.getString(PKG, "Spoon.Dialog.ResourceSerialized"), BaseMessages.getString(PKG, "Spoon.Dialog.ResourceSerializedSuccesfully"), message);
enterTextDialog.setReadOnly();
enterTextDialog.open();
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.Error"), BaseMessages.getString(PKG, "Spoon.ErrorExportingFile"), e);
}
}
use of org.pentaho.di.ui.core.dialog.EnterTextDialog in project pentaho-kettle by pentaho.
the class SpoonSlave method remove.
protected void remove() {
TreeEntry treeEntry = getTreeEntry();
if (treeEntry == null) {
return;
}
if (treeEntry.isTransformation()) {
// Transformation
SlaveServerTransStatus transStatus = slaveServerStatus.findTransStatus(treeEntry.name, treeEntry.id);
if (transStatus != null) {
if (!transStatus.isRunning() && !transStatus.isPaused() && !transStatus.isStopped()) {
try {
WebResult webResult = slaveServer.removeTransformation(treeEntry.name, transStatus.getId());
if (WebResult.STRING_OK.equalsIgnoreCase(webResult.getResult())) {
// Force refresh in order to give faster visual feedback and reengage the timer
wTree.deselectAll();
engageViewAndLogUpdateTimer();
} else {
EnterTextDialog dialog = new EnterTextDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorRemovingTrans.Title"), BaseMessages.getString(PKG, "SpoonSlave.ErrorRemovingTrans.Message"), webResult.getMessage());
dialog.setReadOnly();
dialog.open();
}
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorRemovingTrans.Title"), BaseMessages.getString(PKG, "SpoonSlave.ErrorRemovingTrans.Message"), e);
}
}
}
} else if (treeEntry.isJob()) {
// Job
SlaveServerJobStatus jobStatus = slaveServerStatus.findJobStatus(treeEntry.name, treeEntry.id);
if (jobStatus != null) {
if (!jobStatus.isRunning()) {
try {
WebResult webResult = slaveServer.removeJob(treeEntry.name, jobStatus.getId());
if (WebResult.STRING_OK.equalsIgnoreCase(webResult.getResult())) {
// Force refresh in order to give faster visual feedback and reengage the timer
wTree.deselectAll();
engageViewAndLogUpdateTimer();
} else {
EnterTextDialog dialog = new EnterTextDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorRemovingJob.Title"), BaseMessages.getString(PKG, "SpoonSlave.ErrorRemovingJob.Message"), webResult.getMessage());
dialog.setReadOnly();
dialog.open();
}
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorRemovingJob.Title"), BaseMessages.getString(PKG, "SpoonSlave.ErrorRemovingJob.Message"), e);
}
}
}
}
}
use of org.pentaho.di.ui.core.dialog.EnterTextDialog in project pentaho-kettle by pentaho.
the class SpoonSlave method stop.
protected void stop() {
TreeEntry treeEntry = getTreeEntry();
if (treeEntry == null) {
return;
}
if (treeEntry.isTransformation()) {
// Transformation
SlaveServerTransStatus transStatus = slaveServerStatus.findTransStatus(treeEntry.name, treeEntry.id);
if (transStatus != null) {
if (transStatus.isRunning() || transStatus.isPaused()) {
try {
WebResult webResult = slaveServer.stopTransformation(treeEntry.name, transStatus.getId());
if (!WebResult.STRING_OK.equalsIgnoreCase(webResult.getResult())) {
EnterTextDialog dialog = new EnterTextDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorStoppingTrans.Title"), BaseMessages.getString(PKG, "SpoonSlave.ErrorStoppingTrans.Message"), webResult.getMessage());
dialog.setReadOnly();
dialog.open();
}
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorStoppingTrans.Title"), BaseMessages.getString(PKG, "SpoonSlave.ErrorStoppingTrans.Message"), e);
}
}
}
} else if (treeEntry.isJob()) {
// Job
SlaveServerJobStatus jobStatus = slaveServerStatus.findJobStatus(treeEntry.name, treeEntry.id);
if (jobStatus != null) {
if (jobStatus.isRunning()) {
try {
WebResult webResult = slaveServer.stopJob(treeEntry.name, jobStatus.getId());
if (!WebResult.STRING_OK.equalsIgnoreCase(webResult.getResult())) {
EnterTextDialog dialog = new EnterTextDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorStoppingJob.Title"), BaseMessages.getString(PKG, "SpoonSlave.ErrorStoppingJob.Message"), webResult.getMessage());
dialog.setReadOnly();
dialog.open();
}
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorStoppingJob.Title"), BaseMessages.getString(PKG, "SpoonSlave.ErrorStoppingJob.Message"), e);
}
}
}
}
}
Aggregations