use of org.apache.hop.core.action.GuiContextAction in project hop by apache.
the class HopGuiWorkflowGraph method detachAction.
@GuiContextAction(id = "workflow-graph-action-10100-action-detach", parentId = HopGuiWorkflowActionContext.CONTEXT_ID, type = GuiActionType.Modify, name = "i18n::HopGuiWorkflowGraph.ContextualAction.DetachAction.Text", tooltip = "i18n::HopGuiWorkflowGraph.ContextualAction.DetachAction.Tooltip", image = "ui/images/HOP_delete.svg", category = "i18n::HopGuiWorkflowGraph.ContextualAction.Category.Basic.Text", categoryOrder = "1")
public void detachAction(HopGuiWorkflowActionContext context) {
ActionMeta actionMeta = context.getActionMeta();
WorkflowHopMeta fromHop = workflowMeta.findWorkflowHopTo(actionMeta);
WorkflowHopMeta toHop = workflowMeta.findWorkflowHopFrom(actionMeta);
for (int i = workflowMeta.nrWorkflowHops() - 1; i >= 0; i--) {
WorkflowHopMeta hop = workflowMeta.getWorkflowHop(i);
if (actionMeta.equals(hop.getFromAction()) || actionMeta.equals(hop.getToAction())) {
// Action is connected with a hop, remove this hop.
//
hopGui.undoDelegate.addUndoNew(workflowMeta, new WorkflowHopMeta[] { hop }, new int[] { i });
workflowMeta.removeWorkflowHop(i);
}
}
//
if (fromHop != null && toHop != null) {
workflowHopDelegate.newHop(workflowMeta, new WorkflowHopMeta(fromHop.getFromAction(), toHop.getToAction()));
}
updateGui();
}
use of org.apache.hop.core.action.GuiContextAction in project hop by apache.
the class HopGuiWorkflowGraph method deleteNote.
@GuiContextAction(id = "workflow-graph-20-delete-note", parentId = HopGuiWorkflowNoteContext.CONTEXT_ID, type = GuiActionType.Delete, name = "i18n::HopGuiWorkflowGraph.ContextualAction.DeleteNote.Text", tooltip = "HopGuiWorkflowGraph.ContextualAction.DeleteNote.Tooltip", image = "ui/images/delete.svg", category = "i18n::HopGuiWorkflowGraph.ContextualAction.Category.Basic.Text", categoryOrder = "1")
public void deleteNote(HopGuiWorkflowNoteContext context) {
selectionRegion = null;
NotePadMeta note = context.getNotePadMeta();
int idx = workflowMeta.indexOfNote(note);
if (idx >= 0) {
workflowMeta.removeNote(idx);
hopGui.undoDelegate.addUndoDelete(workflowMeta, new NotePadMeta[] { note }, new int[] { idx });
}
adjustScrolling();
redraw();
}
use of org.apache.hop.core.action.GuiContextAction in project hop by apache.
the class HopGuiWorkflowGraph method newNote.
@GuiContextAction(id = "workflow-graph-new-note", parentId = HopGuiWorkflowContext.CONTEXT_ID, type = GuiActionType.Create, name = "i18n::HopGuiWorkflowGraph.ContextualAction.CreateNote.Text", tooltip = "i18n::HopGuiWorkflowGraph.ContextualAction.CreateNote.Tooltip", image = "ui/images/note-add.svg", category = "i18n::HopGuiWorkflowGraph.ContextualAction.Category.Basic.Text", categoryOrder = "1")
public void newNote(HopGuiWorkflowContext context) {
String title = BaseMessages.getString(PKG, "WorkflowGraph.Dialog.EditNote.Title");
NotePadDialog dd = new NotePadDialog(variables, hopShell(), title);
NotePadMeta n = dd.open();
if (n != null) {
NotePadMeta npi = new NotePadMeta(n.getNote(), context.getClick().x, context.getClick().y, ConstUi.NOTE_MIN_SIZE, ConstUi.NOTE_MIN_SIZE, n.getFontName(), n.getFontSize(), n.isFontBold(), n.isFontItalic(), n.getFontColorRed(), n.getFontColorGreen(), n.getFontColorBlue(), n.getBackGroundColorRed(), n.getBackGroundColorGreen(), n.getBackGroundColorBlue(), n.getBorderColorRed(), n.getBorderColorGreen(), n.getBorderColorBlue());
workflowMeta.addNote(npi);
hopGui.undoDelegate.addUndoNew(workflowMeta, new NotePadMeta[] { npi }, new int[] { workflowMeta.indexOfNote(npi) });
adjustScrolling();
redraw();
}
}
use of org.apache.hop.core.action.GuiContextAction in project hop by apache.
the class TestingGuiPlugin method writeTransformDataToDataSet.
/**
* Ask which data set to write to Ask for the mapping between the output row and the data set
* field Start the pipeline and capture the output of the transform, write to the database table
* backing the data set.
*/
@GuiContextAction(id = "pipeline-graph-transform-20500-write-transform-data-to-set", parentId = HopGuiPipelineTransformContext.CONTEXT_ID, type = GuiActionType.Create, name = "i18n::TestingGuiPlugin.ContextAction.Run.Name", tooltip = "i18n::TestingGuiPlugin.ContextAction.Run.Tooltip", image = "write-to-dataset.svg", category = "i18n::TestingGuiPlugin.Category", categoryOrder = "8")
public void writeTransformDataToDataSet(HopGuiPipelineTransformContext context) {
HopGui hopGui = HopGui.getInstance();
IHopMetadataProvider metadataProvider = hopGui.getMetadataProvider();
IVariables variables = context.getPipelineGraph().getVariables();
TransformMeta transformMeta = context.getTransformMeta();
PipelineMeta pipelineMeta = context.getPipelineMeta();
if (pipelineMeta.hasChanged()) {
MessageBox box = new MessageBox(hopGui.getShell(), SWT.OK | SWT.ICON_INFORMATION);
box.setText(BaseMessages.getString(PKG, "TestingGuiPlugin.ContextAction.Run.SavePipelineDialog.Header"));
box.setMessage(BaseMessages.getString(PKG, "TestingGuiPlugin.ContextAction.Run.SavePipelineDialog.Message"));
box.open();
return;
}
try {
IHopMetadataSerializer<DataSet> setSerializer = metadataProvider.getSerializer(DataSet.class);
// Ask which data set to write to
//
List<String> setNames = setSerializer.listObjectNames();
Collections.sort(setNames);
EnterSelectionDialog esd = new EnterSelectionDialog(hopGui.getShell(), setNames.toArray(new String[setNames.size()]), BaseMessages.getString(PKG, "TestingGuiPlugin.ContextAction.Run.ActionList.Item1"), BaseMessages.getString(PKG, "TestingGuiPlugin.ContextAction.Run.ActionList.Item2"));
String setName = esd.open();
if (setName == null) {
return;
}
DataSet dataSet = setSerializer.load(setName);
String[] setFields = new String[dataSet.getFields().size()];
for (int i = 0; i < setFields.length; i++) {
setFields[i] = dataSet.getFields().get(i).getFieldName();
}
IRowMeta rowMeta = pipelineMeta.getTransformFields(variables, transformMeta);
String[] transformFields = new String[rowMeta.size()];
for (int i = 0; i < rowMeta.size(); i++) {
IValueMeta valueMeta = rowMeta.getValueMeta(i);
transformFields[i] = valueMeta.getName();
}
// Ask for the mapping between the output row and the data set field
//
EnterMappingDialog mappingDialog = new EnterMappingDialog(hopGui.getShell(), transformFields, setFields);
List<SourceToTargetMapping> mapping = mappingDialog.open();
if (mapping == null) {
return;
}
// Run the pipeline. We want to use the standard HopGui runFile() method
// So we need to leave the source to target mapping list somewhere so it can be picked up
// later.
// For now we'll leave it where we need it.
//
WriteToDataSetExtensionPoint.transformsMap.put(pipelineMeta.getName(), transformMeta);
WriteToDataSetExtensionPoint.mappingsMap.put(pipelineMeta.getName(), mapping);
WriteToDataSetExtensionPoint.setsMap.put(pipelineMeta.getName(), dataSet);
// Signal to the pipeline xp plugin to inject data into some data set
//
variables.setVariable(DataSetConst.VAR_WRITE_TO_DATASET, "Y");
// Start the pipeline
//
context.getPipelineGraph().start();
} catch (Exception e) {
new ErrorDialog(hopGui.getShell(), BaseMessages.getString(PKG, "TestingGuiPlugin.ContextAction.Run.Error.Header"), BaseMessages.getString(PKG, "TestingGuiPlugin.ContextAction.Run.Error.Message"), e);
}
}
use of org.apache.hop.core.action.GuiContextAction in project hop by apache.
the class TestingGuiPlugin method enableTweakRemoveTransformInUnitTest.
@GuiContextAction(id = ACTION_ID_PIPELINE_GRAPH_TRANSFORM_ENABLE_TWEAK_REMOVE_TRANSFORM, parentId = HopGuiPipelineTransformContext.CONTEXT_ID, type = GuiActionType.Modify, name = "i18n::TestingGuiPlugin.ContextAction.RemoveFromTest.Name", tooltip = "i18n::TestingGuiPlugin.ContextAction.RemoveFromTest.Tooltip", image = "Test_tube_icon.svg", category = "i18n::TestingGuiPlugin.Category", categoryOrder = "8")
public void enableTweakRemoveTransformInUnitTest(HopGuiPipelineTransformContext context) {
IVariables variables = context.getPipelineGraph().getVariables();
tweakRemoveTransformInUnitTest(variables, context.getPipelineMeta(), context.getTransformMeta(), true);
}
Aggregations