use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class Spoon method editSelectAll.
public void editSelectAll() {
TransMeta transMeta = getActiveTransformation();
if (transMeta != null) {
transMeta.selectAll();
getActiveTransGraph().redraw();
}
JobMeta jobMeta = getActiveJob();
if (jobMeta != null) {
jobMeta.selectAll();
getActiveJobGraph().redraw();
}
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class TextFileInputDialog method preview.
// Preview the data
private void preview() {
// Create the XML input step
TextFileInputMeta oneMeta = new TextFileInputMeta();
getInfo(oneMeta, true);
if (oneMeta.inputFiles.acceptingFilenames) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
mb.setMessage(BaseMessages.getString(PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Message"));
mb.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Title"));
mb.open();
return;
}
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "TextFileInputDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "TextFileInputDialog.PreviewSize.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled()) {
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();
}
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class JobGraph method loadReferencedObject.
protected void loadReferencedObject(JobEntryCopy jobEntryCopy, int index) {
try {
Object referencedMeta = jobEntryCopy.getEntry().loadReferencedObject(index, spoon.rep, spoon.metaStore, jobMeta);
if (referencedMeta == null) {
// Compatible re-try for older plugins.
referencedMeta = compatibleJobEntryLoadReferencedObject(jobEntryCopy.getEntry(), index, spoon.rep, jobMeta);
}
if (referencedMeta != null && (referencedMeta instanceof TransMeta)) {
TransMeta launchTransMeta = (TransMeta) referencedMeta;
// Try to see if this transformation is already loaded in another tab...
//
TabMapEntry tabEntry = spoon.delegates.tabs.findTabForTransformation(launchTransMeta);
if (tabEntry != null) {
// Switch to this one!
//
spoon.tabfolder.setSelected(tabEntry.getTabItem());
return;
}
copyInternalJobVariables(jobMeta, launchTransMeta);
spoon.setParametersAsVariablesInUI(launchTransMeta, launchTransMeta);
launchTransMeta.clearChanged();
spoon.addTransGraph(launchTransMeta);
TransGraph transGraph = spoon.getActiveTransGraph();
attachActiveTrans(transGraph, launchTransMeta, jobEntryCopy);
spoon.refreshTree();
spoon.applyVariables();
}
if (referencedMeta != null && (referencedMeta instanceof JobMeta)) {
JobMeta launchJobMeta = (JobMeta) referencedMeta;
// Try to see if this job is already loaded in another tab...
//
String tabName = spoon.delegates.tabs.makeTabName(launchJobMeta, true);
TabMapEntry tabEntry = spoon.delegates.tabs.findTabMapEntry(tabName, ObjectType.JOB_GRAPH);
if (tabEntry != null) {
// Switch to this one!
//
spoon.tabfolder.setSelected(tabEntry.getTabItem());
return;
}
spoon.setParametersAsVariablesInUI(launchJobMeta, launchJobMeta);
launchJobMeta.clearChanged();
spoon.addJobGraph(launchJobMeta);
JobGraph jobGraph = spoon.getActiveJobGraph();
attachActiveJob(jobGraph, launchJobMeta, jobEntryCopy);
spoon.refreshTree();
spoon.applyVariables();
}
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "JobGraph.Dialog.ErrorLaunchingSpoonCanNotLoadTransformation.Title"), BaseMessages.getString(PKG, "JobGraph.Dialog.ErrorLaunchingSpoonCanNotLoadTransformation.Message"), e);
}
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class TransGraph method enableDisableNextHops.
private Set<StepMeta> enableDisableNextHops(StepMeta from, boolean enabled, Set<StepMeta> checkedEntries) {
checkedEntries.add(from);
transMeta.getTransHops().stream().filter(hop -> from.equals(hop.getFromStep())).forEach(hop -> {
if (hop.isEnabled() != enabled) {
TransHopMeta before = (TransHopMeta) hop.clone();
setHopEnabled(hop, enabled);
TransHopMeta after = (TransHopMeta) hop.clone();
spoon.addUndoChange(transMeta, new TransHopMeta[] { before }, new TransHopMeta[] { after }, new int[] { transMeta.indexOfTransHop(hop) });
}
if (!checkedEntries.contains(hop.getToStep())) {
enableDisableNextHops(hop.getToStep(), enabled, checkedEntries);
}
});
return checkedEntries;
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class TransGraph method editProperties.
public static boolean editProperties(TransMeta transMeta, Spoon spoon, Repository rep, boolean allowDirectoryChange, TransDialog.Tabs currentTab) {
if (transMeta == null) {
return false;
}
TransDialog tid = new TransDialog(spoon.getShell(), SWT.NONE, transMeta, rep, currentTab);
tid.setDirectoryChangeAllowed(allowDirectoryChange);
TransMeta ti = tid.open();
//
if (tid.isSharedObjectsFileChanged()) {
try {
SharedObjects sharedObjects = rep != null ? rep.readTransSharedObjects(transMeta) : transMeta.readSharedObjects();
spoon.sharedObjectsFileMap.put(sharedObjects.getFilename(), sharedObjects);
} catch (KettleException e) {
// CHECKSTYLE:LineLength:OFF
new ErrorDialog(spoon.getShell(), BaseMessages.getString(PKG, "Spoon.Dialog.ErrorReadingSharedObjects.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.ErrorReadingSharedObjects.Message", spoon.makeTabName(transMeta, true)), e);
}
// If we added properties, add them to the variables too, so that they appear in the CTRL-SPACE variable
// completion.
//
spoon.setParametersAsVariablesInUI(transMeta, transMeta);
spoon.refreshTree();
// cheap operation, might as will do it anyway
spoon.delegates.tabs.renameTabs();
}
spoon.setShellText();
return ti != null;
}
Aggregations