Search in sources :

Example 1 with HopGuiPipelineContext

use of org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineContext 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)

Example 2 with HopGuiPipelineContext

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

the class HopGuiPipelineGraph method mouseDoubleClick.

@Override
public void mouseDoubleClick(MouseEvent e) {
    if (!PropsUi.getInstance().useDoubleClick()) {
        return;
    }
    doubleClick = true;
    clearSettings();
    Point real = screen2real(e.x, e.y);
    // Hide the tooltip!
    hideToolTips();
    AreaOwner areaOwner = getVisibleAreaOwner(real.x, real.y);
    try {
        HopGuiPipelineGraphExtension ext = new HopGuiPipelineGraphExtension(this, e, real, areaOwner);
        ExtensionPointHandler.callExtensionPoint(LogChannel.GENERAL, variables, HopExtensionPoint.PipelineGraphMouseDoubleClick.id, ext);
        if (ext.isPreventingDefault()) {
            return;
        }
    } catch (Exception ex) {
        LogChannel.GENERAL.logError("Error calling PipelineGraphMouseDoubleClick extension point", ex);
    }
    TransformMeta transformMeta = pipelineMeta.getTransform(real.x, real.y, iconSize);
    if (transformMeta != null) {
        if (e.button == 1) {
            editTransform(transformMeta);
        } else {
            editDescription(transformMeta);
        }
    } else {
        // Check if point lies on one of the many hop-lines...
        PipelineHopMeta online = findPipelineHop(real.x, real.y);
        if (online != null) {
            editHop(online);
        } else {
            NotePadMeta ni = pipelineMeta.getNote(real.x, real.y);
            if (ni != null) {
                selectedNote = null;
                editNote(ni);
            } else {
                // 
                if (areaOwner != null && areaOwner.getParent() instanceof TransformMeta && areaOwner.getOwner().equals(PipelinePainter.STRING_PARTITIONING_CURRENT_TRANSFORM)) {
                    TransformMeta transform = (TransformMeta) areaOwner.getParent();
                    pipelineTransformDelegate.editTransformPartitioning(pipelineMeta, transform);
                } else {
                    editPipelineProperties(new HopGuiPipelineContext(pipelineMeta, this, real));
                }
            }
        }
    }
}
Also used : HopGuiPipelineContext(org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineContext) HopExtensionPoint(org.apache.hop.core.extension.HopExtensionPoint) HopException(org.apache.hop.core.exception.HopException) InvocationTargetException(java.lang.reflect.InvocationTargetException) HopTransformException(org.apache.hop.core.exception.HopTransformException) HopValueException(org.apache.hop.core.exception.HopValueException) HopGuiPipelineGraphExtension(org.apache.hop.ui.hopgui.file.pipeline.extension.HopGuiPipelineGraphExtension)

Aggregations

HopExtensionPoint (org.apache.hop.core.extension.HopExtensionPoint)2 HopGuiPipelineContext (org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineContext)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)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 IGuiContextHandler (org.apache.hop.ui.hopgui.context.IGuiContextHandler)1 HopGuiPipelineHopContext (org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineHopContext)1 HopGuiPipelineNoteContext (org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineNoteContext)1 HopGuiPipelineTransformContext (org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineTransformContext)1 HopGuiPipelineGraphExtension (org.apache.hop.ui.hopgui.file.pipeline.extension.HopGuiPipelineGraphExtension)1