Search in sources :

Example 61 with StepMeta

use of org.pentaho.di.trans.step.StepMeta 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 62 with StepMeta

use of org.pentaho.di.trans.step.StepMeta in project pentaho-kettle by pentaho.

the class TransGraph method mouseUp.

@Override
public void mouseUp(MouseEvent e) {
    try {
        TransGraphExtension ext = new TransGraphExtension(null, e, getArea());
        ExtensionPointHandler.callExtensionPoint(LogChannel.GENERAL, KettleExtensionPoint.TransGraphMouseUp.id, ext);
        if (ext.isPreventDefault()) {
            redraw();
            clearSettings();
            return;
        }
    } catch (Exception ex) {
        LogChannel.GENERAL.logError("Error calling TransGraphMouseUp extension point", ex);
    }
    boolean control = (e.stateMask & SWT.MOD1) != 0;
    TransHopMeta selectedHop = findHop(e.x, e.y);
    updateErrorMetaForHop(selectedHop);
    if (iconoffset == null) {
        iconoffset = new Point(0, 0);
    }
    Point real = screen2real(e.x, e.y);
    Point icon = new Point(real.x - iconoffset.x, real.y - iconoffset.y);
    AreaOwner areaOwner = getVisibleAreaOwner(real.x, real.y);
    try {
        TransGraphExtension ext = new TransGraphExtension(this, e, real);
        ExtensionPointHandler.callExtensionPoint(LogChannel.GENERAL, KettleExtensionPoint.TransGraphMouseUp.id, ext);
        if (ext.isPreventDefault()) {
            redraw();
            clearSettings();
            return;
        }
    } catch (Exception ex) {
        LogChannel.GENERAL.logError("Error calling TransGraphMouseUp extension point", ex);
    }
    // 
    if (candidate != null && areaOwner != null && areaOwner.getAreaType() != null) {
        switch(areaOwner.getAreaType()) {
            case STEP_ICON:
                currentStep = (StepMeta) areaOwner.getOwner();
                break;
            case STEP_INPUT_HOP_ICON:
                currentStep = (StepMeta) areaOwner.getParent();
                break;
            default:
                break;
        }
        addCandidateAsHop(e.x, e.y);
        redraw();
    } else {
        // 
        if (selectionRegion != null) {
            selectionRegion.width = real.x - selectionRegion.x;
            selectionRegion.height = real.y - selectionRegion.y;
            transMeta.unselectAll();
            selectInRect(transMeta, selectionRegion);
            selectionRegion = null;
            stopStepMouseOverDelayTimers();
            redraw();
        } else {
            // 
            if (selectedStep != null && startHopStep == null) {
                if (e.button == 1) {
                    Point realclick = screen2real(e.x, e.y);
                    if (lastclick.x == realclick.x && lastclick.y == realclick.y) {
                        // Flip selection when control is pressed!
                        if (control) {
                            selectedStep.flipSelected();
                        } else {
                            // Otherwise, select only the icon clicked on!
                            transMeta.unselectAll();
                            selectedStep.setSelected(true);
                        }
                    } else {
                        // Find out which Steps & Notes are selected
                        selectedSteps = transMeta.getSelectedSteps();
                        selectedNotes = transMeta.getSelectedNotes();
                        // We moved around some items: store undo info...
                        // 
                        boolean also = false;
                        if (selectedNotes != null && selectedNotes.size() > 0 && previous_note_locations != null) {
                            int[] indexes = transMeta.getNoteIndexes(selectedNotes);
                            addUndoPosition(selectedNotes.toArray(new NotePadMeta[selectedNotes.size()]), indexes, previous_note_locations, transMeta.getSelectedNoteLocations(), also);
                            also = selectedSteps != null && selectedSteps.size() > 0;
                        }
                        if (selectedSteps != null && previous_step_locations != null) {
                            int[] indexes = transMeta.getStepIndexes(selectedSteps);
                            addUndoPosition(selectedSteps.toArray(new StepMeta[selectedSteps.size()]), indexes, previous_step_locations, transMeta.getSelectedStepLocations(), also);
                        }
                    }
                }
                // If so, ask to split the hop!
                if (split_hop) {
                    TransHopMeta hi = findHop(icon.x + iconsize / 2, icon.y + iconsize / 2, selectedStep);
                    if (hi != null) {
                        splitHop(hi);
                    }
                    split_hop = false;
                }
                selectedSteps = null;
                selectedNotes = null;
                selectedStep = null;
                selectedNote = null;
                startHopStep = null;
                endHopLocation = null;
                redraw();
                spoon.setShellText();
            } else {
                if (selectedNote != null) {
                    if (e.button == 1) {
                        if (lastclick.x == e.x && lastclick.y == e.y) {
                            // Flip selection when control is pressed!
                            if (control) {
                                selectedNote.flipSelected();
                            } else {
                                // Otherwise, select only the note clicked on!
                                transMeta.unselectAll();
                                selectedNote.setSelected(true);
                            }
                        } else {
                            // Find out which Steps & Notes are selected
                            selectedSteps = transMeta.getSelectedSteps();
                            selectedNotes = transMeta.getSelectedNotes();
                            // We moved around some items: store undo info...
                            boolean also = false;
                            if (selectedNotes != null && selectedNotes.size() > 0 && previous_note_locations != null) {
                                int[] indexes = transMeta.getNoteIndexes(selectedNotes);
                                addUndoPosition(selectedNotes.toArray(new NotePadMeta[selectedNotes.size()]), indexes, previous_note_locations, transMeta.getSelectedNoteLocations(), also);
                                also = selectedSteps != null && selectedSteps.size() > 0;
                            }
                            if (selectedSteps != null && selectedSteps.size() > 0 && previous_step_locations != null) {
                                int[] indexes = transMeta.getStepIndexes(selectedSteps);
                                addUndoPosition(selectedSteps.toArray(new StepMeta[selectedSteps.size()]), indexes, previous_step_locations, transMeta.getSelectedStepLocations(), also);
                            }
                        }
                    }
                    selectedNotes = null;
                    selectedSteps = null;
                    selectedStep = null;
                    selectedNote = null;
                    startHopStep = null;
                    endHopLocation = null;
                } else {
                    if (areaOwner == null && selectionRegion == null) {
                        // Hit absolutely nothing: clear the settings
                        // 
                        clearSettings();
                    }
                }
            }
        }
    }
    lastButton = 0;
}
Also used : AreaOwner(org.pentaho.di.core.gui.AreaOwner) TransHopMeta(org.pentaho.di.trans.TransHopMeta) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) NotePadMeta(org.pentaho.di.core.NotePadMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) XulException(org.pentaho.ui.xul.XulException) InvocationTargetException(java.lang.reflect.InvocationTargetException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) KettleException(org.pentaho.di.core.exception.KettleException)

Example 63 with StepMeta

use of org.pentaho.di.trans.step.StepMeta in project pentaho-kettle by pentaho.

the class TransGraph method mouseMove.

@Override
public void mouseMove(MouseEvent e) {
    boolean shift = (e.stateMask & SWT.SHIFT) != 0;
    noInputStep = null;
    // disable the tooltip
    // 
    toolTip.hide();
    Point real = screen2real(e.x, e.y);
    // Remember the last position of the mouse for paste with keyboard
    // 
    lastMove = real;
    if (iconoffset == null) {
        iconoffset = new Point(0, 0);
    }
    Point icon = new Point(real.x - iconoffset.x, real.y - iconoffset.y);
    if (noteoffset == null) {
        noteoffset = new Point(0, 0);
    }
    Point note = new Point(real.x - noteoffset.x, real.y - noteoffset.y);
    // Moved over an area?
    // 
    AreaOwner areaOwner = getVisibleAreaOwner(real.x, real.y);
    if (areaOwner != null && areaOwner.getAreaType() != null) {
        switch(areaOwner.getAreaType()) {
            case STEP_ICON:
                StepMeta stepMeta = (StepMeta) areaOwner.getOwner();
                resetDelayTimer(stepMeta);
                break;
            case // Give the timer a bit more time
            MINI_ICONS_BALLOON:
                stepMeta = (StepMeta) areaOwner.getParent();
                resetDelayTimer(stepMeta);
                break;
            default:
                break;
        }
    }
    try {
        TransGraphExtension ext = new TransGraphExtension(this, e, real);
        ExtensionPointHandler.callExtensionPoint(LogChannel.GENERAL, KettleExtensionPoint.TransGraphMouseMoved.id, ext);
    } catch (Exception ex) {
        LogChannel.GENERAL.logError("Error calling TransGraphMouseMoved extension point", ex);
    }
    // 
    if (selectedStep != null && !selectedStep.isSelected()) {
        transMeta.unselectAll();
        selectedStep.setSelected(true);
        selectedSteps = new ArrayList<>();
        selectedSteps.add(selectedStep);
        previous_step_locations = new Point[] { selectedStep.getLocation() };
        redraw();
    } else if (selectedNote != null && !selectedNote.isSelected()) {
        transMeta.unselectAll();
        selectedNote.setSelected(true);
        selectedNotes = new ArrayList<>();
        selectedNotes.add(selectedNote);
        previous_note_locations = new Point[] { selectedNote.getLocation() };
        redraw();
    } else if (selectionRegion != null && startHopStep == null) {
        // Did we select a region...?
        // 
        selectionRegion.width = real.x - selectionRegion.x;
        selectionRegion.height = real.y - selectionRegion.y;
        redraw();
    } else if (selectedStep != null && lastButton == 1 && !shift && startHopStep == null) {
        // 
        // One or more icons are selected and moved around...
        // 
        // new : new position of the ICON (not the mouse pointer) dx : difference with previous position
        // 
        int dx = icon.x - selectedStep.getLocation().x;
        int dy = icon.y - selectedStep.getLocation().y;
        // See if we have a hop-split candidate
        // 
        TransHopMeta hi = findHop(icon.x + iconsize / 2, icon.y + iconsize / 2, selectedStep);
        if (hi != null) {
            // 
            if (!hi.getFromStep().equals(selectedStep) && !hi.getToStep().equals(selectedStep)) {
                split_hop = true;
                last_hop_split = hi;
                hi.split = true;
            }
        } else {
            if (last_hop_split != null) {
                last_hop_split.split = false;
                last_hop_split = null;
                split_hop = false;
            }
        }
        selectedNotes = transMeta.getSelectedNotes();
        selectedSteps = transMeta.getSelectedSteps();
        // Adjust location of selected steps...
        if (selectedSteps != null) {
            for (int i = 0; i < selectedSteps.size(); i++) {
                StepMeta stepMeta = selectedSteps.get(i);
                PropsUI.setLocation(stepMeta, stepMeta.getLocation().x + dx, stepMeta.getLocation().y + dy);
                stopStepMouseOverDelayTimer(stepMeta);
            }
        }
        // Adjust location of selected hops...
        if (selectedNotes != null) {
            for (int i = 0; i < selectedNotes.size(); i++) {
                NotePadMeta ni = selectedNotes.get(i);
                PropsUI.setLocation(ni, ni.getLocation().x + dx, ni.getLocation().y + dy);
            }
        }
        redraw();
    } else if ((startHopStep != null && endHopStep == null) || (endHopStep != null && startHopStep == null)) {
        // Are we creating a new hop with the middle button or pressing SHIFT?
        // 
        StepMeta stepMeta = transMeta.getStep(real.x, real.y, iconsize);
        endHopLocation = new Point(real.x, real.y);
        if (stepMeta != null && ((startHopStep != null && !startHopStep.equals(stepMeta)) || (endHopStep != null && !endHopStep.equals(stepMeta)))) {
            StepIOMetaInterface ioMeta = stepMeta.getStepMetaInterface().getStepIOMeta();
            if (candidate == null) {
                // 
                if (startHopStep != null) {
                    if (ioMeta.isInputAcceptor()) {
                        candidate = new TransHopMeta(startHopStep, stepMeta);
                        endHopLocation = null;
                    } else {
                        noInputStep = stepMeta;
                        toolTip.setImage(null);
                        toolTip.setText("This step does not accept any input from other steps");
                        toolTip.show(new org.eclipse.swt.graphics.Point(real.x, real.y));
                    }
                } else if (endHopStep != null) {
                    if (ioMeta.isOutputProducer()) {
                        candidate = new TransHopMeta(stepMeta, endHopStep);
                        endHopLocation = null;
                    } else {
                        noInputStep = stepMeta;
                        toolTip.setImage(null);
                        toolTip.setText("This step doesn't pass any output to other steps. (except perhaps for targetted output)");
                        toolTip.show(new org.eclipse.swt.graphics.Point(real.x, real.y));
                    }
                }
            }
        } else {
            if (candidate != null) {
                candidate = null;
                redraw();
            }
        }
        redraw();
    }
    // 
    if (selectedNote != null) {
        if (lastButton == 1 && !shift) {
            /*
         * One or more notes are selected and moved around...
         *
         * new : new position of the note (not the mouse pointer) dx : difference with previous position
         */
            int dx = note.x - selectedNote.getLocation().x;
            int dy = note.y - selectedNote.getLocation().y;
            selectedNotes = transMeta.getSelectedNotes();
            selectedSteps = transMeta.getSelectedSteps();
            // Adjust location of selected steps...
            if (selectedSteps != null) {
                for (int i = 0; i < selectedSteps.size(); i++) {
                    StepMeta stepMeta = selectedSteps.get(i);
                    PropsUI.setLocation(stepMeta, stepMeta.getLocation().x + dx, stepMeta.getLocation().y + dy);
                }
            }
            // Adjust location of selected hops...
            if (selectedNotes != null) {
                for (int i = 0; i < selectedNotes.size(); i++) {
                    NotePadMeta ni = selectedNotes.get(i);
                    PropsUI.setLocation(ni, ni.getLocation().x + dx, ni.getLocation().y + dy);
                }
            }
            redraw();
        }
    }
}
Also used : ArrayList(java.util.ArrayList) StepIOMetaInterface(org.pentaho.di.trans.step.StepIOMetaInterface) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) StepMeta(org.pentaho.di.trans.step.StepMeta) XulException(org.pentaho.ui.xul.XulException) InvocationTargetException(java.lang.reflect.InvocationTargetException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) KettleException(org.pentaho.di.core.exception.KettleException) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) AreaOwner(org.pentaho.di.core.gui.AreaOwner) TransHopMeta(org.pentaho.di.trans.TransHopMeta) NotePadMeta(org.pentaho.di.core.NotePadMeta)

Example 64 with StepMeta

use of org.pentaho.di.trans.step.StepMeta in project pentaho-kettle by pentaho.

the class TransGraph method renameStep.

public void renameStep(StepMeta stepMeta, String stepname) {
    String newname = stepname;
    StepMeta smeta = transMeta.findStep(newname, stepMeta);
    int nr = 2;
    while (smeta != null) {
        newname = stepname + " " + nr;
        smeta = transMeta.findStep(newname);
        nr++;
    }
    if (nr > 2) {
        stepname = newname;
        MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
        mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.StepnameExists.Message", stepname));
        mb.setText(BaseMessages.getString(PKG, "Spoon.Dialog.StepnameExists.Title"));
        mb.open();
    }
    stepMeta.setName(stepname);
    stepMeta.setChanged();
    // to reflect the new name
    spoon.refreshTree();
    spoon.refreshGraph();
}
Also used : StepMeta(org.pentaho.di.trans.step.StepMeta) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 65 with StepMeta

use of org.pentaho.di.trans.step.StepMeta in project pentaho-kettle by pentaho.

the class TransGraph method enableHopsBetweenSelectedSteps.

/**
 * This method enables or disables all the hops between the selected steps.
 */
public void enableHopsBetweenSelectedSteps(boolean enabled) {
    List<StepMeta> list = transMeta.getSelectedSteps();
    boolean hasLoop = false;
    for (int i = 0; i < transMeta.nrTransHops(); i++) {
        TransHopMeta hop = transMeta.getTransHop(i);
        if (list.contains(hop.getFromStep()) && list.contains(hop.getToStep())) {
            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 (transMeta.hasLoop(hop.getToStep())) {
                hasLoop = true;
                setHopEnabled(hop, false);
            }
        }
    }
    if (enabled && hasLoop) {
        MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
        mb.setMessage(BaseMessages.getString(PKG, "TransGraph.Dialog.HopCausesLoop.Message"));
        mb.setText(BaseMessages.getString(PKG, "TransGraph.Dialog.HopCausesLoop.Title"));
        mb.open();
    }
    spoon.refreshGraph();
}
Also used : TransHopMeta(org.pentaho.di.trans.TransHopMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

StepMeta (org.pentaho.di.trans.step.StepMeta)637 TransMeta (org.pentaho.di.trans.TransMeta)228 KettleException (org.pentaho.di.core.exception.KettleException)174 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)167 Test (org.junit.Test)162 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)147 TransHopMeta (org.pentaho.di.trans.TransHopMeta)128 Trans (org.pentaho.di.trans.Trans)119 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)113 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)107 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)106 StepInterface (org.pentaho.di.trans.step.StepInterface)92 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)79 Point (org.pentaho.di.core.gui.Point)79 FormAttachment (org.eclipse.swt.layout.FormAttachment)76 FormData (org.eclipse.swt.layout.FormData)76 FormLayout (org.eclipse.swt.layout.FormLayout)76 Label (org.eclipse.swt.widgets.Label)76 Shell (org.eclipse.swt.widgets.Shell)76 Button (org.eclipse.swt.widgets.Button)75