Search in sources :

Example 61 with TransMeta

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();
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) TransMeta(org.pentaho.di.trans.TransMeta)

Example 62 with TransMeta

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();
    }
}
Also used : TextFileInputMeta(org.pentaho.di.trans.steps.fileinput.text.TextFileInputMeta) TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) TransMeta(org.pentaho.di.trans.TransMeta) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.pentaho.di.ui.core.dialog.EnterNumberDialog) Trans(org.pentaho.di.trans.Trans) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 63 with TransMeta

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);
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) TransMeta(org.pentaho.di.trans.TransMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) SimpleLoggingObject(org.pentaho.di.core.logging.SimpleLoggingObject) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) TabMapEntry(org.pentaho.di.ui.spoon.TabMapEntry) XulException(org.pentaho.ui.xul.XulException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) KettleException(org.pentaho.di.core.exception.KettleException)

Example 64 with TransMeta

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;
}
Also used : StepDebugMeta(org.pentaho.di.trans.debug.StepDebugMeta) RepositoryExplorerDialog(org.pentaho.di.ui.repository.dialog.RepositoryExplorerDialog) Arrays(java.util.Arrays) JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) SashForm(org.eclipse.swt.custom.SashForm) MouseMoveListener(org.eclipse.swt.events.MouseMoveListener) XulException(org.pentaho.ui.xul.XulException) DefaultToolTip(org.eclipse.jface.window.DefaultToolTip) AbstractGraph(org.pentaho.di.ui.spoon.AbstractGraph) Point(org.pentaho.di.core.gui.Point) DND(org.eclipse.swt.dnd.DND) RepositorySecurityUI(org.pentaho.di.ui.repository.RepositorySecurityUI) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) XulToolbarbutton(org.pentaho.ui.xul.components.XulToolbarbutton) DropTargetEvent(org.eclipse.swt.dnd.DropTargetEvent) XulSpoonResourceBundle(org.pentaho.di.ui.spoon.XulSpoonResourceBundle) Composite(org.eclipse.swt.widgets.Composite) StepFieldsDialog(org.pentaho.di.ui.core.dialog.StepFieldsDialog) KeyEvent(org.eclipse.swt.events.KeyEvent) Job(org.pentaho.di.job.Job) Map(java.util.Map) ConstUI(org.pentaho.di.ui.core.ConstUI) TabItemInterface(org.pentaho.di.ui.spoon.TabItemInterface) DialogClosedListener(org.pentaho.di.ui.core.dialog.DialogClosedListener) LoggingRegistry(org.pentaho.di.core.logging.LoggingRegistry) TimerTask(java.util.TimerTask) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) KeyAdapter(org.eclipse.swt.events.KeyAdapter) DatabaseImpact(org.pentaho.di.trans.DatabaseImpact) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) LogParentProvidedInterface(org.pentaho.di.core.logging.LogParentProvidedInterface) RowDistributionInterface(org.pentaho.di.trans.step.RowDistributionInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface) CTabFolder(org.eclipse.swt.custom.CTabFolder) BasePainter(org.pentaho.di.core.gui.BasePainter) Device(org.eclipse.swt.graphics.Device) JfaceMenupopup(org.pentaho.ui.xul.jface.tags.JfaceMenupopup) RowDistributionPluginType(org.pentaho.di.trans.step.RowDistributionPluginType) PropsUI(org.pentaho.di.ui.core.PropsUI) Set(java.util.Set) CheckBoxToolTipListener(org.pentaho.di.ui.core.widget.CheckBoxToolTipListener) ToolItem(org.eclipse.swt.widgets.ToolItem) Utils(org.pentaho.di.core.util.Utils) Transfer(org.eclipse.swt.dnd.Transfer) LogChannel(org.pentaho.di.core.logging.LogChannel) InvocationTargetException(java.lang.reflect.InvocationTargetException) MouseEvent(org.eclipse.swt.events.MouseEvent) KettleValueException(org.pentaho.di.core.exception.KettleValueException) Redrawable(org.pentaho.di.core.gui.Redrawable) StepMetaDataCombi(org.pentaho.di.trans.step.StepMetaDataCombi) MenuItem(org.eclipse.swt.widgets.MenuItem) SWT(org.eclipse.swt.SWT) KettleStepException(org.pentaho.di.core.exception.KettleStepException) JfaceMenuitem(org.pentaho.ui.xul.jface.tags.JfaceMenuitem) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) EnterStringDialog(org.pentaho.di.ui.core.dialog.EnterStringDialog) TransExecutionConfiguration(org.pentaho.di.trans.TransExecutionConfiguration) SWTGC(org.pentaho.di.ui.spoon.SWTGC) PaintListener(org.eclipse.swt.events.PaintListener) RowListener(org.pentaho.di.trans.step.RowListener) NotePadDialog(org.pentaho.di.ui.spoon.dialog.NotePadDialog) CheckResultInterface(org.pentaho.di.core.CheckResultInterface) SnapAllignDistribute(org.pentaho.di.core.gui.SnapAllignDistribute) Callable(java.util.concurrent.Callable) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) DragAndDropContainer(org.pentaho.di.core.dnd.DragAndDropContainer) Spoon(org.pentaho.di.ui.spoon.Spoon) ArrayList(java.util.ArrayList) AreaType(org.pentaho.di.core.gui.AreaOwner.AreaType) LoggingObjectType(org.pentaho.di.core.logging.LoggingObjectType) RepositoryObjectType(org.pentaho.di.repository.RepositoryObjectType) SwtUniversalImage(org.pentaho.di.core.SwtUniversalImage) EnterPreviewRowsDialog(org.pentaho.di.ui.spoon.dialog.EnterPreviewRowsDialog) Const(org.pentaho.di.core.Const) ResourceBundle(java.util.ResourceBundle) TransDataLineage(org.pentaho.di.lineage.TransDataLineage) StringTokenizer(java.util.StringTokenizer) GCInterface(org.pentaho.di.core.gui.GCInterface) Document(org.pentaho.ui.xul.dom.Document) GridData(org.eclipse.swt.layout.GridData) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) XulEventHandler(org.pentaho.ui.xul.impl.XulEventHandler) Shell(org.eclipse.swt.widgets.Shell) SimpleLoggingObject(org.pentaho.di.core.logging.SimpleLoggingObject) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) FormLayout(org.eclipse.swt.layout.FormLayout) Repository(org.pentaho.di.repository.Repository) SharedObjects(org.pentaho.di.shared.SharedObjects) FormData(org.eclipse.swt.layout.FormData) JobMeta(org.pentaho.di.job.JobMeta) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) SpoonPluginManager(org.pentaho.di.ui.spoon.SpoonPluginManager) DefaultLogLevel(org.pentaho.di.core.logging.DefaultLogLevel) TransDebugMeta(org.pentaho.di.trans.debug.TransDebugMeta) RepositoryRevisionBrowserDialogInterface(org.pentaho.di.ui.repository.dialog.RepositoryRevisionBrowserDialogInterface) MessageBox(org.eclipse.swt.widgets.MessageBox) ToolTip(org.eclipse.jface.window.ToolTip) LoggingObjectInterface(org.pentaho.di.core.logging.LoggingObjectInterface) TableInputMeta(org.pentaho.di.trans.steps.tableinput.TableInputMeta) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) StreamType(org.pentaho.di.trans.step.errorhandling.StreamInterface.StreamType) ExtensionPointHandler(org.pentaho.di.core.extension.ExtensionPointHandler) StepErrorMeta(org.pentaho.di.trans.step.StepErrorMeta) Trans(org.pentaho.di.trans.Trans) DisposeEvent(org.eclipse.swt.events.DisposeEvent) KettleLogStore(org.pentaho.di.core.logging.KettleLogStore) StepPluginType(org.pentaho.di.core.plugins.StepPluginType) XulToolbar(org.pentaho.ui.xul.containers.XulToolbar) DisposeListener(org.eclipse.swt.events.DisposeListener) ToolBar(org.eclipse.swt.widgets.ToolBar) GUIResource(org.pentaho.di.ui.core.gui.GUIResource) Timer(java.util.Timer) SpoonUiExtenderPluginInterface(org.pentaho.di.ui.spoon.SpoonUiExtenderPluginInterface) PaintEvent(org.eclipse.swt.events.PaintEvent) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) TransMeta(org.pentaho.di.trans.TransMeta) NotePadMeta(org.pentaho.di.core.NotePadMeta) Widget(org.eclipse.swt.widgets.Widget) BaseMessages(org.pentaho.di.i18n.BaseMessages) TransPainter(org.pentaho.di.trans.TransPainter) StepInterface(org.pentaho.di.trans.step.StepInterface) DropTarget(org.eclipse.swt.dnd.DropTarget) MouseWheelListener(org.eclipse.swt.events.MouseWheelListener) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) SpoonUiExtenderPluginType(org.pentaho.di.ui.spoon.SpoonUiExtenderPluginType) Display(org.eclipse.swt.widgets.Display) UUID(java.util.UUID) CheckBoxToolTip(org.pentaho.di.ui.core.widget.CheckBoxToolTip) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) TransDebugMetaWrapper(org.pentaho.di.trans.debug.TransDebugMetaWrapper) AreaOwner(org.pentaho.di.core.gui.AreaOwner) MouseListener(org.eclipse.swt.events.MouseListener) List(java.util.List) LogMessage(org.pentaho.di.core.logging.LogMessage) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) SwtScrollBar(org.pentaho.di.ui.spoon.SwtScrollBar) BreakPointListener(org.pentaho.di.trans.debug.BreakPointListener) StreamIcon(org.pentaho.di.trans.step.errorhandling.StreamIcon) MouseAdapter(org.eclipse.swt.events.MouseAdapter) Label(org.eclipse.swt.widgets.Label) XulMenuitem(org.pentaho.ui.xul.components.XulMenuitem) Stream(org.pentaho.di.trans.step.errorhandling.Stream) HasLogChannelInterface(org.pentaho.di.core.logging.HasLogChannelInterface) KettleException(org.pentaho.di.core.exception.KettleException) Image(org.eclipse.swt.graphics.Image) HashMap(java.util.HashMap) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) HashSet(java.util.HashSet) XulMenu(org.pentaho.ui.xul.containers.XulMenu) XulSpoonSettingsManager(org.pentaho.di.ui.spoon.XulSpoonSettingsManager) PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry) MessageDialogWithToggle(org.eclipse.jface.dialogs.MessageDialogWithToggle) Canvas(org.eclipse.swt.widgets.Canvas) SearchFieldsProgressDialog(org.pentaho.di.ui.spoon.dialog.SearchFieldsProgressDialog) FillLayout(org.eclipse.swt.layout.FillLayout) KettleLoggingEvent(org.pentaho.di.core.logging.KettleLoggingEvent) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) Props(org.pentaho.di.core.Props) RemoteStep(org.pentaho.di.trans.step.RemoteStep) Combo(org.eclipse.swt.widgets.Combo) TransSupplier(org.pentaho.di.trans.TransSupplier) DropTargetListener(org.eclipse.swt.dnd.DropTargetListener) XulMenupopup(org.pentaho.ui.xul.containers.XulMenupopup) Action(org.eclipse.jface.action.Action) FormAttachment(org.eclipse.swt.layout.FormAttachment) TransDialog(org.pentaho.di.ui.trans.dialog.TransDialog) CTabItem(org.eclipse.swt.custom.CTabItem) RepositoryOperation(org.pentaho.di.repository.RepositoryOperation) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface) TransHopMeta(org.pentaho.di.trans.TransHopMeta) XMLTransfer(org.pentaho.di.core.dnd.XMLTransfer) KeyListener(org.eclipse.swt.events.KeyListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Menu(org.eclipse.swt.widgets.Menu) StepIOMetaInterface(org.pentaho.di.trans.step.StepIOMetaInterface) Control(org.eclipse.swt.widgets.Control) TransHopMeta(org.pentaho.di.trans.TransHopMeta)

Example 65 with TransMeta

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;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TransMeta(org.pentaho.di.trans.TransMeta) TransDialog(org.pentaho.di.ui.trans.dialog.TransDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) SharedObjects(org.pentaho.di.shared.SharedObjects)

Aggregations

TransMeta (org.pentaho.di.trans.TransMeta)710 Test (org.junit.Test)289 StepMeta (org.pentaho.di.trans.step.StepMeta)234 Trans (org.pentaho.di.trans.Trans)214 KettleException (org.pentaho.di.core.exception.KettleException)150 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)136 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)117 TransHopMeta (org.pentaho.di.trans.TransHopMeta)115 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)109 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)106 StepInterface (org.pentaho.di.trans.step.StepInterface)76 RowStepCollector (org.pentaho.di.trans.RowStepCollector)73 JobMeta (org.pentaho.di.job.JobMeta)69 ArrayList (java.util.ArrayList)57 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)54 PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)51 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)50 InjectorMeta (org.pentaho.di.trans.steps.injector.InjectorMeta)49 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)49 TransPreviewProgressDialog (org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog)49