use of org.apache.hop.core.gui.plugin.action.GuiAction in project hop by apache.
the class HopGuiPipelineHopContext method getSupportedActions.
/**
* Create a list of supported actions on a pipeline. These are picked up from the annotations,
* mostly in PipelineGraph. Plugins can add actions as well.
*
* @return The list of supported actions
*/
@Override
public List<GuiAction> getSupportedActions() {
List<GuiAction> actions = new ArrayList<>();
// Get the actions from the plugins...
//
List<GuiAction> pluginActions = getPluginActions(true);
if (pluginActions != null) {
for (GuiAction pluginAction : pluginActions) {
// See if the action is applicable to the hop.
//
actions.add(lambdaBuilder.createLambda(pluginAction, this, pipelineGraph));
}
}
return actions;
}
use of org.apache.hop.core.gui.plugin.action.GuiAction in project hop by apache.
the class HopGuiPipelineTransformContext method getSupportedActions.
/**
* Create a list of supported actions on a pipeline. We'll add the creation of every possible
* transform as well as the modification of the pipeline itself.
*
* @return The list of supported actions
*/
@Override
public List<GuiAction> getSupportedActions() {
List<GuiAction> actions = new ArrayList<>();
// Put references at the start since we use those things a lot
//
ITransformMeta iTransformMeta = transformMeta.getTransform();
String[] objectDescriptions = iTransformMeta.getReferencedObjectDescriptions();
for (int i = 0; objectDescriptions != null && i < objectDescriptions.length; i++) {
final String objectDescription = objectDescriptions[i];
if (iTransformMeta.isReferencedObjectEnabled()[i]) {
final int index = i;
GuiAction openReferencedAction = new GuiAction("transform-open-referenced-" + objectDescription, GuiActionType.Info, BaseMessages.getString(PKG, "HopGuiPipelineTransformContext.OpenReferencedAction.Name", objectDescription), BaseMessages.getString(PKG, "HopGuiPipelineTransformContext.OpenReferencedAction.Tooltip"), "ui/images/open.svg", (shiftAction, controlAction, t) -> openReferencedObject(pipelineMeta, pipelineGraph.getVariables(), iTransformMeta, objectDescription, index));
openReferencedAction.setCategory("Basic");
openReferencedAction.setCategoryOrder("1");
actions.add(openReferencedAction);
}
}
// Get the actions from the plugins, sorted by ID...
//
List<GuiAction> pluginActions = getPluginActions(true);
if (pluginActions != null) {
for (GuiAction pluginAction : pluginActions) {
actions.add(lambdaBuilder.createLambda(pluginAction, this, pipelineGraph));
}
}
return actions;
}
use of org.apache.hop.core.gui.plugin.action.GuiAction 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.core.gui.plugin.action.GuiAction in project hop by apache.
the class HopGuiWorkflowActionContext method getSupportedActions.
/**
* Create a list of supported actions on a action.
*
* @return The list of supported actions
*/
@Override
public List<GuiAction> getSupportedActions() {
List<GuiAction> actions = new ArrayList<>();
// Put references at the start since we use those things a lot
//
IAction action = actionMeta.getAction();
String[] objectDescriptions = action.getReferencedObjectDescriptions();
for (int i = 0; objectDescriptions != null && i < objectDescriptions.length; i++) {
final String objectDescription = objectDescriptions[i];
if (action.isReferencedObjectEnabled()[i]) {
final int index = i;
GuiAction openReferencedAction = new GuiAction("action-open-referenced-" + objectDescription, GuiActionType.Info, BaseMessages.getString(PKG, "HopGuiWorkflowTransformContext.OpenReferencedAction.Name", objectDescription), BaseMessages.getString(PKG, "HopGuiWorkflowTransformContext.OpenReferencedAction.Tooltip"), "ui/images/open.svg", (shiftAction, controlAction, t) -> openReferencedObject(workflowMeta, workflowGraph.getVariables(), action, objectDescription, index));
openReferencedAction.setCategory("Basic");
openReferencedAction.setCategoryOrder("1");
actions.add(openReferencedAction);
}
}
// Get the actions from the plugins, sorted by ID...
//
List<GuiAction> pluginActions = getPluginActions(true);
if (pluginActions != null) {
for (GuiAction pluginAction : pluginActions) {
actions.add(lambdaBuilder.createLambda(pluginAction, this, workflowGraph));
}
}
return actions;
}
use of org.apache.hop.core.gui.plugin.action.GuiAction in project hop by apache.
the class HopGuiWorkflowContext method getSupportedActions.
/**
* Create a list of supported actions on a workflow. We'll add the creation of every possible
* action as well as the modification of the workflow itself from the annotations.
*
* @return The list of supported actions
*/
@Override
public List<GuiAction> getSupportedActions() {
List<GuiAction> guiActions = new ArrayList<>();
// Get the actions from the plugins...
//
List<GuiAction> pluginActions = getPluginActions(true);
if (pluginActions != null) {
for (GuiAction pluginAction : pluginActions) {
guiActions.add(lambdaBuilder.createLambda(pluginAction, this, workflowGraph));
}
}
// Also add all the entry creation actions...
//
PluginRegistry registry = PluginRegistry.getInstance();
List<IPlugin> actionPlugins = registry.getPlugins(ActionPluginType.class);
for (IPlugin actionPlugin : actionPlugins) {
GuiAction createActionGuiAction = new GuiAction("workflow-graph-create-workflow-action-" + actionPlugin.getIds()[0], GuiActionType.Create, actionPlugin.getName(), actionPlugin.getDescription(), actionPlugin.getImageFile(), (shiftClicked, controlClicked, t) -> workflowGraph.workflowActionDelegate.newAction(workflowMeta, actionPlugin.getIds()[0], actionPlugin.getName(), controlClicked, click));
createActionGuiAction.getKeywords().addAll(Arrays.asList(actionPlugin.getKeywords()));
createActionGuiAction.setCategory(actionPlugin.getCategory());
createActionGuiAction.setCategoryOrder(// sort alphabetically
"9999_" + actionPlugin.getCategory());
try {
createActionGuiAction.setClassLoader(registry.getClassLoader(actionPlugin));
} catch (HopPluginException e) {
LogChannel.UI.logError("Unable to get classloader for action plugin " + actionPlugin.getIds()[0], e);
}
createActionGuiAction.getKeywords().add(actionPlugin.getCategory());
guiActions.add(createActionGuiAction);
}
return guiActions;
}
Aggregations