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);
}
}
}
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);
}
}
}
}
Aggregations