use of org.apache.hop.ui.hopgui.context.IGuiContextHandler 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);
}
}
}
}
use of org.apache.hop.ui.hopgui.context.IGuiContextHandler in project hop by apache.
the class HopPipelineFileType method getContextHandlers.
@Override
public List<IGuiContextHandler> getContextHandlers() {
HopGui hopGui = HopGui.getInstance();
List<IGuiContextHandler> handlers = new ArrayList<>();
GuiAction newAction = new GuiAction(ACTION_ID_NEW_PIPELINE, GuiActionType.Create, BaseMessages.getString(PKG, "HopPipelineFileType.GuiAction.Pipeline.Name"), BaseMessages.getString(PKG, "HopPipelineFileType.GuiAction.Pipeline.Tooltip"), "ui/images/pipeline.svg", (shiftClicked, controlClicked, parameters) -> {
try {
HopPipelineFileType.this.newFile(hopGui, hopGui.getVariables());
} catch (Exception e) {
new ErrorDialog(hopGui.getShell(), BaseMessages.getString(PKG, "HopPipelineFileType.ErrorDialog.PipelineDrawing.Header"), BaseMessages.getString(PKG, "HopPipelineFileType.ErrorDialog.PipelineDrawing.Message"), e);
}
});
newAction.setCategory("File");
newAction.setCategoryOrder("1");
handlers.add(new GuiContextHandler(ACTION_ID_NEW_PIPELINE, Arrays.asList(newAction)));
return handlers;
}
use of org.apache.hop.ui.hopgui.context.IGuiContextHandler in project hop by apache.
the class HopGuiWorkflowGraph method showContextDialog.
private void showContextDialog(MouseEvent e, Point real, boolean fSingleClick, SingleClickType fSingleClickType, ActionMeta fSingleClickAction, NotePadMeta fSingleClickNote, WorkflowHopMeta fSingleClickHop) {
// In any case clear the selection region...
//
selectionRegion = null;
//
if (fSingleClickType == SingleClickType.Workflow) {
if (workflowMeta.getSelectedActions().size() > 0 || workflowMeta.getSelectedNotes().size() > 0) {
workflowMeta.unselectAll();
selectionRegion = null;
updateGui();
// Show a short tooltip
//
toolTip.setVisible(false);
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 Workflow:
message = BaseMessages.getString(PKG, "HopGuiWorkflowGraph.ContextualActionDialog.Workflow.Header");
contextHandler = new HopGuiWorkflowContext(workflowMeta, this, real);
break;
case Action:
message = BaseMessages.getString(PKG, "HopGuiWorkflowGraph.ContextualActionDialog.Action.Header", fSingleClickAction.getName());
contextHandler = new HopGuiWorkflowActionContext(workflowMeta, fSingleClickAction, this, real);
break;
case Note:
message = BaseMessages.getString(PKG, "HopGuiWorkflowGraph.ContextualActionDialog.Note.Header");
contextHandler = new HopGuiWorkflowNoteContext(workflowMeta, fSingleClickNote, this, real);
break;
case Hop:
message = BaseMessages.getString(PKG, "HopGuiWorkflowGraph.ContextualActionDialog.Hop.Header");
contextHandler = new HopGuiWorkflowHopContext(workflowMeta, 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
//
ignoreNextClick = GuiContextUtil.getInstance().handleActionSelection(parent, message, new Point(p.x, p.y), contextHandler);
}
}
}
}
use of org.apache.hop.ui.hopgui.context.IGuiContextHandler in project hop by apache.
the class HopWorkflowFileType method getContextHandlers.
@Override
public List<IGuiContextHandler> getContextHandlers() {
HopGui hopGui = HopGui.getInstance();
List<IGuiContextHandler> handlers = new ArrayList<>();
GuiAction newAction = new GuiAction(ACTION_ID_NEW_WORKFLOW, GuiActionType.Create, BaseMessages.getString(PKG, "HopWorkflowFileType.GuiAction.Workflow.Name"), BaseMessages.getString(PKG, "HopWorkflowFileType.GuiAction.Workflow.Tooltip"), "ui/images/workflow.svg", (shiftClicked, controlClicked, parameters) -> {
try {
HopWorkflowFileType.this.newFile(hopGui, hopGui.getVariables());
} catch (Exception e) {
new ErrorDialog(hopGui.getShell(), BaseMessages.getString(PKG, "HopWorkflowFileType.ErrorDialog.NewWorkflowCreation.Header"), BaseMessages.getString(PKG, "HopWorkflowFileType.ErrorDialog.NewWorkflowCreation.Message"), e);
}
});
newAction.setCategory("File");
newAction.setCategoryOrder("1");
handlers.add(new GuiContextHandler(ACTION_ID_NEW_WORKFLOW, Arrays.asList(newAction)));
return handlers;
}
use of org.apache.hop.ui.hopgui.context.IGuiContextHandler in project hop by apache.
the class HopGui method getContextHandlers.
/**
* What are the contexts to consider: - the file types registered - the available metadata types
*
* @return The list of context handlers
*/
@Override
public List<IGuiContextHandler> getContextHandlers() {
List<IGuiContextHandler> contextHandlers = new ArrayList<>();
// Get all the file context handlers
//
HopFileTypeRegistry registry = HopFileTypeRegistry.getInstance();
List<IHopFileType> hopFileTypes = registry.getFileTypes();
for (IHopFileType hopFileType : hopFileTypes) {
contextHandlers.addAll(hopFileType.getContextHandlers());
}
// Get all the metadata context handlers...
//
contextHandlers.addAll(new MetadataContext(this, metadataProvider).getContextHandlers());
return contextHandlers;
}
Aggregations