Search in sources :

Example 1 with HopGuiPipelineTransformContext

use of org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineTransformContext in project hop by apache.

the class HopGuiPipelineGraph method sniff.

@GuiContextAction(id = "pipeline-graph-transform-12000-sniff-output", parentId = HopGuiPipelineTransformContext.CONTEXT_ID, type = GuiActionType.Info, name = "i18n::HopGuiPipelineGraph.PipelineAction.SniffOutput.Name", tooltip = "i18n::HopGuiPipelineGraph.PipelineAction.SniffOutput.Tooltip", image = "ui/images/preview.svg", category = "Preview", categoryOrder = "3")
public void sniff(HopGuiPipelineTransformContext context) {
    TransformMeta transformMeta = context.getTransformMeta();
    if (pipeline == null) {
        MessageBox messageBox = new MessageBox(hopShell(), SWT.ICON_INFORMATION | SWT.OK);
        messageBox.setText(BaseMessages.getString(PKG, "PipelineGraph.SniffTestingAvailableWhenRunning.Title"));
        messageBox.setMessage(BaseMessages.getString(PKG, "PipelineGraph.SniffTestingAvailableWhenRunning.Message"));
        messageBox.open();
        return;
    }
    if (pipeline.isFinished()) {
    // Show collected sample data...
    // 
    } else {
        try {
            pipeline.retrieveComponentOutput(hopGui.getVariables(), transformMeta.getName(), 0, 50, ((pipelineEngine, rowBuffer) -> hopDisplay().asyncExec(() -> {
                PreviewRowsDialog dialog = new PreviewRowsDialog(hopShell(), hopGui.getVariables(), SWT.NONE, transformMeta.getName(), rowBuffer.getRowMeta(), rowBuffer.getBuffer());
                dialog.open();
            })));
        } catch (HopException e) {
            new ErrorDialog(hopShell(), "Error", "Error sniffing rows", e);
        }
    }
}
Also used : org.apache.hop.core(org.apache.hop.core) AreaType(org.apache.hop.core.gui.AreaOwner.AreaType) SwtGc(org.apache.hop.ui.hopgui.shared.SwtGc) StringUtils(org.apache.commons.lang.StringUtils) StreamIcon(org.apache.hop.pipeline.transform.stream.StreamIcon) SashForm(org.eclipse.swt.custom.SashForm) org.apache.hop.core.logging(org.apache.hop.core.logging) XmlHandler(org.apache.hop.core.xml.XmlHandler) PipelineDebugMeta(org.apache.hop.pipeline.debug.PipelineDebugMeta) Stream(org.apache.hop.pipeline.transform.stream.Stream) HopException(org.apache.hop.core.exception.HopException) GuiContextActionFilter(org.apache.hop.core.action.GuiContextActionFilter) GC(org.eclipse.swt.graphics.GC) SampleType(org.apache.hop.pipeline.engines.local.LocalPipelineRunConfiguration.SampleType) LocalPipelineEngine(org.apache.hop.pipeline.engines.local.LocalPipelineEngine) GuiContextAction(org.apache.hop.core.action.GuiContextAction) NotePadDialog(org.apache.hop.ui.hopgui.dialog.NotePadDialog) org.apache.hop.ui.hopgui.file.pipeline.delegates(org.apache.hop.ui.hopgui.file.pipeline.delegates) HopGuiTooltipExtension(org.apache.hop.ui.hopgui.file.shared.HopGuiTooltipExtension) HopGuiPipelineNoteContext(org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineNoteContext) HopGuiPipelineGraphExtension(org.apache.hop.ui.hopgui.file.pipeline.extension.HopGuiPipelineGraphExtension) IGuiRefresher(org.apache.hop.core.gui.plugin.IGuiRefresher) OsHelper(org.apache.hop.ui.core.widget.OsHelper) org.apache.hop.pipeline(org.apache.hop.pipeline) CTabFolder(org.eclipse.swt.custom.CTabFolder) TransformDebugMeta(org.apache.hop.pipeline.debug.TransformDebugMeta) HopNamespace(org.apache.hop.ui.core.gui.HopNamespace) EnterPreviewRowsDialog(org.apache.hop.ui.hopgui.dialog.EnterPreviewRowsDialog) IGuiContextHandler(org.apache.hop.ui.hopgui.context.IGuiContextHandler) HopGuiServerDelegate(org.apache.hop.ui.hopgui.delegates.HopGuiServerDelegate) InvocationTargetException(java.lang.reflect.InvocationTargetException) HopTransformException(org.apache.hop.core.exception.HopTransformException) GuiToolbarElement(org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement) HopDataOrchestrationPerspective(org.apache.hop.ui.hopgui.perspective.dataorch.HopDataOrchestrationPerspective) List(java.util.List) FileName(org.apache.commons.vfs2.FileName) HopValueException(org.apache.hop.core.exception.HopValueException) SWT(org.eclipse.swt.SWT) PipelineDialog(org.apache.hop.ui.pipeline.dialog.PipelineDialog) StreamType(org.apache.hop.pipeline.transform.stream.IStream.StreamType) IPlugin(org.apache.hop.core.plugins.IPlugin) RowBuffer(org.apache.hop.core.row.RowBuffer) Utils(org.apache.hop.core.util.Utils) java.util(java.util) SvgFile(org.apache.hop.core.svg.SvgFile) org.apache.hop.ui.core.dialog(org.apache.hop.ui.core.dialog) BasePropertyHandler(org.apache.hop.laf.BasePropertyHandler) IHopFileTypeHandler(org.apache.hop.ui.hopgui.file.IHopFileTypeHandler) Image(org.eclipse.swt.graphics.Image) Rectangle(org.eclipse.swt.graphics.Rectangle) GuiPlugin(org.apache.hop.core.gui.plugin.GuiPlugin) GuiKeyboardShortcut(org.apache.hop.core.gui.plugin.key.GuiKeyboardShortcut) GuiActionType(org.apache.hop.core.gui.plugin.action.GuiActionType) HopGuiAbstractGraph(org.apache.hop.ui.hopgui.perspective.dataorch.HopGuiAbstractGraph) PipelineDataLineage(org.apache.hop.lineage.PipelineDataLineage) LocalPipelineRunConfiguration(org.apache.hop.pipeline.engines.local.LocalPipelineRunConfiguration) CheckPipelineProgressDialog(org.apache.hop.ui.hopgui.dialog.CheckPipelineProgressDialog) ConstUi(org.apache.hop.ui.core.ConstUi) org.apache.hop.core.gui(org.apache.hop.core.gui) SwtScrollBar(org.apache.hop.ui.hopgui.shared.SwtScrollBar) PipelineRunConfiguration(org.apache.hop.pipeline.config.PipelineRunConfiguration) ExtensionPointHandler(org.apache.hop.core.extension.ExtensionPointHandler) SearchFieldsProgressDialog(org.apache.hop.ui.hopgui.dialog.SearchFieldsProgressDialog) IEngineComponent(org.apache.hop.pipeline.engine.IEngineComponent) PipelineEngineFactory(org.apache.hop.pipeline.engine.PipelineEngineFactory) OutputStream(java.io.OutputStream) IStream(org.apache.hop.pipeline.transform.stream.IStream) IRowMeta(org.apache.hop.core.row.IRowMeta) org.apache.hop.pipeline.transform(org.apache.hop.pipeline.transform) HopGuiNotePadDelegate(org.apache.hop.ui.hopgui.file.delegates.HopGuiNotePadDelegate) org.eclipse.swt.events(org.eclipse.swt.events) HopVfs(org.apache.hop.core.vfs.HopVfs) BaseMessages(org.apache.hop.i18n.BaseMessages) GuiResource(org.apache.hop.ui.core.gui.GuiResource) FormLayout(org.eclipse.swt.layout.FormLayout) EnvironmentUtils(org.apache.hop.ui.util.EnvironmentUtils) FormData(org.eclipse.swt.layout.FormData) org.eclipse.swt.widgets(org.eclipse.swt.widgets) org.apache.hop.ui.hopgui(org.apache.hop.ui.hopgui) FormAttachment(org.eclipse.swt.layout.FormAttachment) FileObject(org.apache.commons.vfs2.FileObject) IPipelineEngine(org.apache.hop.pipeline.engine.IPipelineEngine) GuiContextUtil(org.apache.hop.ui.hopgui.context.GuiContextUtil) HopGuiPipelineFinishedExtension(org.apache.hop.ui.hopgui.file.pipeline.extension.HopGuiPipelineFinishedExtension) GuiToolbarElementType(org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElementType) PropsUi(org.apache.hop.ui.core.PropsUi) CTabItem(org.eclipse.swt.custom.CTabItem) AuditManager(org.apache.hop.history.AuditManager) GuiOsxKeyboardShortcut(org.apache.hop.core.gui.plugin.key.GuiOsxKeyboardShortcut) PluginRegistry(org.apache.hop.core.plugins.PluginRegistry) HopGuiPipelineContext(org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineContext) HopGuiPipelineHopContext(org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineHopContext) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) HopExtensionPoint(org.apache.hop.core.extension.HopExtensionPoint) GuiToolbarWidgets(org.apache.hop.ui.core.gui.GuiToolbarWidgets) HopGuiPipelineTransformContext(org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineTransformContext) HopException(org.apache.hop.core.exception.HopException) EnterPreviewRowsDialog(org.apache.hop.ui.hopgui.dialog.EnterPreviewRowsDialog) GuiContextAction(org.apache.hop.core.action.GuiContextAction)

Example 2 with HopGuiPipelineTransformContext

use of org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineTransformContext in project hop by apache.

the class HopGuiPipelineGraph method showActionDialog.

private void showActionDialog(MouseEvent e, Point real, boolean fSingleClick, SingleClickType fSingleClickType, TransformMeta fSingleClickTransform, NotePadMeta fSingleClickNote, PipelineHopMeta fSingleClickHop) {
    // In any case clear the selection region...
    // 
    selectionRegion = null;
    // 
    if (fSingleClickType == SingleClickType.Pipeline) {
        if (pipelineMeta.getSelectedTransforms().size() > 0 || pipelineMeta.getSelectedNotes().size() > 0) {
            pipelineMeta.unselectAll();
            selectionRegion = null;
            updateGui();
            // Show a short tooltip
            // 
            toolTip.setVisible(false);
            toolTip.setAutoHide(true);
            toolTip.setText(Const.CR + "  Selection cleared " + Const.CR);
            showToolTip(new org.eclipse.swt.graphics.Point(e.x, e.y));
            return;
        }
    }
    if (!doubleClick) {
        // 
        if (fSingleClick && fSingleClickType != null) {
            IGuiContextHandler contextHandler = null;
            String message = null;
            switch(fSingleClickType) {
                case Pipeline:
                    message = BaseMessages.getString(PKG, "PipelineGraph.ContextualActionDialog.Pipeline.Header");
                    contextHandler = new HopGuiPipelineContext(pipelineMeta, this, real);
                    break;
                case Transform:
                    message = BaseMessages.getString(PKG, "PipelineGraph.ContextualActionDialog.Transform.Header", fSingleClickTransform.getName());
                    contextHandler = new HopGuiPipelineTransformContext(pipelineMeta, fSingleClickTransform, this, real);
                    break;
                case Note:
                    message = BaseMessages.getString(PKG, "PipelineGraph.ContextualActionDialog.Note.Header");
                    contextHandler = new HopGuiPipelineNoteContext(pipelineMeta, fSingleClickNote, this, real);
                    break;
                case Hop:
                    message = BaseMessages.getString(PKG, "PipelineGraph.ContextualActionDialog.Hop.Header");
                    contextHandler = new HopGuiPipelineHopContext(pipelineMeta, fSingleClickHop, this, real);
                    break;
                default:
                    break;
            }
            if (contextHandler != null) {
                Shell parent = hopShell();
                org.eclipse.swt.graphics.Point p = parent.getDisplay().map(canvas, null, e.x, e.y);
                // Show the context dialog
                // 
                avoidContextDialog = GuiContextUtil.getInstance().handleActionSelection(parent, message, new Point(p.x, p.y), contextHandler);
            }
        }
    }
}
Also used : HopGuiPipelineTransformContext(org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineTransformContext) IGuiContextHandler(org.apache.hop.ui.hopgui.context.IGuiContextHandler) HopGuiPipelineHopContext(org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineHopContext) HopGuiPipelineContext(org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineContext) HopGuiPipelineNoteContext(org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineNoteContext) HopExtensionPoint(org.apache.hop.core.extension.HopExtensionPoint)

Aggregations

HopExtensionPoint (org.apache.hop.core.extension.HopExtensionPoint)2 IGuiContextHandler (org.apache.hop.ui.hopgui.context.IGuiContextHandler)2 HopGuiPipelineContext (org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineContext)2 HopGuiPipelineHopContext (org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineHopContext)2 HopGuiPipelineNoteContext (org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineNoteContext)2 HopGuiPipelineTransformContext (org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineTransformContext)2 OutputStream (java.io.OutputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 java.util (java.util)1 List (java.util.List)1 StringUtils (org.apache.commons.lang.StringUtils)1 FileName (org.apache.commons.vfs2.FileName)1 FileObject (org.apache.commons.vfs2.FileObject)1 org.apache.hop.core (org.apache.hop.core)1 GuiContextAction (org.apache.hop.core.action.GuiContextAction)1 GuiContextActionFilter (org.apache.hop.core.action.GuiContextActionFilter)1 HopException (org.apache.hop.core.exception.HopException)1 HopTransformException (org.apache.hop.core.exception.HopTransformException)1 HopValueException (org.apache.hop.core.exception.HopValueException)1 ExtensionPointHandler (org.apache.hop.core.extension.ExtensionPointHandler)1