Search in sources :

Example 6 with RowDistributionInterface

use of org.pentaho.di.trans.step.RowDistributionInterface in project pentaho-kettle by pentaho.

the class TransGraph method askUserForCustomDistributionMethod.

public RowDistributionInterface askUserForCustomDistributionMethod() {
    List<PluginInterface> plugins = PluginRegistry.getInstance().getPlugins(RowDistributionPluginType.class);
    if (Utils.isEmpty(plugins)) {
        return null;
    }
    List<String> choices = new ArrayList<>();
    for (PluginInterface plugin : plugins) {
        choices.add(plugin.getName() + " : " + plugin.getDescription());
    }
    EnterSelectionDialog dialog = new EnterSelectionDialog(shell, choices.toArray(new String[choices.size()]), "Select distribution method", "Please select the row distribution method:");
    if (dialog.open() != null) {
        PluginInterface plugin = plugins.get(dialog.getSelectionNr());
        try {
            return (RowDistributionInterface) PluginRegistry.getInstance().loadClass(plugin);
        } catch (Exception e) {
            new ErrorDialog(shell, "Error", "Error loading row distribution plugin class", e);
            return null;
        }
    } else {
        return null;
    }
}
Also used : SpoonUiExtenderPluginInterface(org.pentaho.di.ui.spoon.SpoonUiExtenderPluginInterface) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) ArrayList(java.util.ArrayList) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowDistributionInterface(org.pentaho.di.trans.step.RowDistributionInterface) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) XulException(org.pentaho.ui.xul.XulException) InvocationTargetException(java.lang.reflect.InvocationTargetException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) KettleException(org.pentaho.di.core.exception.KettleException)

Aggregations

RowDistributionInterface (org.pentaho.di.trans.step.RowDistributionInterface)6 KettleException (org.pentaho.di.core.exception.KettleException)4 PluginInterface (org.pentaho.di.core.plugins.PluginInterface)4 StepMeta (org.pentaho.di.trans.step.StepMeta)4 Point (org.pentaho.di.core.gui.Point)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 NotePadMeta (org.pentaho.di.core.NotePadMeta)2 KettleStepException (org.pentaho.di.core.exception.KettleStepException)2 KettleValueException (org.pentaho.di.core.exception.KettleValueException)2 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)2 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)2 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)2 TransHopMeta (org.pentaho.di.trans.TransHopMeta)2 StepMetaInterface (org.pentaho.di.trans.step.StepMetaInterface)2 MissingTrans (org.pentaho.di.trans.steps.missing.MissingTrans)2 SpoonUiExtenderPluginInterface (org.pentaho.di.ui.spoon.SpoonUiExtenderPluginInterface)2 XulException (org.pentaho.ui.xul.XulException)2 ArrayList (java.util.ArrayList)1 Action (org.eclipse.jface.action.Action)1 MessageDialogWithToggle (org.eclipse.jface.dialogs.MessageDialogWithToggle)1