Class DtActionHelper

java.lang.Object
com._1c.g5.v8.dt.ui.aef.actions.DtActionHelper

public class DtActionHelper extends Object
Various helpers useful for actions.
  • Method Details

    • getEObject

      public static org.eclipse.emf.ecore.EObject getEObject(ISelection selection)
      Obtains EObject from a given selection.
      Parameters:
      selection - selection to obtain EObject from.
      Returns:
      obtained EObject or null if no object could be obtained.
    • getList

      public static org.eclipse.emf.common.util.EList<?> getList(org.eclipse.emf.ecore.EObject model, org.eclipse.emf.ecore.EStructuralFeature feature, ISelection selection)
      Obtains EList for a given model, feature and selection.
      Parameters:
      model - model to obtain EList from.
      feature - feature to obtain EList from.
      selection - selection to obtain EList from.
      Returns:
      obtained EList or null if no list could be obtained.
    • getListForElement

      public static org.eclipse.emf.common.util.EList<?> getListForElement(org.eclipse.emf.ecore.EObject model, org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.emf.ecore.EObject element)
      Obtains EList corresponding to a given model, feature and element.
      Parameters:
      model - model to obtain EList from.
      feature - feature to obtain EList from.
      element - element to obtain EList from.
      Returns:
      obtained EList or null if no list could be obtained.
    • getEditingContext

      public static IBmEditingContext getEditingContext(ISelection selection, org.eclipse.emf.ecore.EObject model)
      Obtains IBmEditingContext for a given selection.
      Parameters:
      selection - selection to obtain IBmEditingContext from.
      model - the model object.
      Returns:
      obtained IBmEditingContext or null if no executor could be obtained.
    • executeAsComplexTask

      public static void executeAsComplexTask(IBmEditingContext editingContext, Collection<?> items, Function<Object,IBmTask<?>> taskCreator)
      Creates an IBmTask for each element in items using taskCreator. Then executes a BmCompoundTask comprised of the created tasks using IBmEditingSupport that corresponds to the model object.

      Note: If for some item no task should be executed, taskCreator shell return null.

      Parameters:
      editingContext - an editing context.
      items - objects to create IBmTasks from
      taskCreator - a Function that creates IBmTask from each object in items
    • executeWizard

      public static void executeWizard(org.eclipse.ui.wizards.IWizardDescriptor wizardDescriptor, ISelection selection)
      Executes the given wizardDescriptor with and provides it with given selection
    • getSelectedObjectList

      public static <T> List<T> getSelectedObjectList(IStructuredSelection selection, Class<T> clazz)
      Returns list of target class selected objects from IStructuredSelection.
      Parameters:
      selection - the source IStructuredSelection, cannot be null
      clazz - the target selected objects class, cannot be null
      Returns:
      the list of target class selected objects, never null