Package com._1c.g5.v8.dt.ui.aef.actions
Class DtActionHelper
java.lang.Object
com._1c.g5.v8.dt.ui.aef.actions.DtActionHelper
Various helpers useful for actions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidexecuteAsComplexTask(IBmEditingContext editingContext, Collection<?> items, Function<Object, IBmTask<?>> taskCreator) static voidexecuteWizard(org.eclipse.ui.wizards.IWizardDescriptor wizardDescriptor, ISelection selection) Executes the givenwizardDescriptorwith and provides it with givenselectionstatic IBmEditingContextgetEditingContext(ISelection selection, org.eclipse.emf.ecore.EObject model) ObtainsIBmEditingContextfor a givenselection.static org.eclipse.emf.ecore.EObjectgetEObject(ISelection selection) ObtainsEObjectfrom a given selection.static org.eclipse.emf.common.util.EList<?>getList(org.eclipse.emf.ecore.EObject model, org.eclipse.emf.ecore.EStructuralFeature feature, ISelection selection) ObtainsEListfor a givenmodel,featureandselection.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) ObtainsEListcorresponding to a givenmodel,featureandelement.static <T> List<T>getSelectedObjectList(IStructuredSelection selection, Class<T> clazz) Returns list of target class selected objects fromIStructuredSelection.
-
Method Details
-
getEObject
ObtainsEObjectfrom a given selection.- Parameters:
selection- selection to obtainEObjectfrom.- Returns:
- obtained
EObjectornullif 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) ObtainsEListfor a givenmodel,featureandselection.- Parameters:
model- model to obtainEListfrom.feature- feature to obtainEListfrom.selection- selection to obtainEListfrom.- Returns:
- obtained
EListornullif 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) ObtainsEListcorresponding to a givenmodel,featureandelement.- Parameters:
model- model to obtainEListfrom.feature- feature to obtainEListfrom.element- element to obtainEListfrom.- Returns:
- obtained
EListornullif no list could be obtained.
-
getEditingContext
public static IBmEditingContext getEditingContext(ISelection selection, org.eclipse.emf.ecore.EObject model) ObtainsIBmEditingContextfor a givenselection.- Parameters:
selection- selection to obtainIBmEditingContextfrom.model- the model object.- Returns:
- obtained
IBmEditingContextornullif no executor could be obtained.
-
executeAsComplexTask
public static void executeAsComplexTask(IBmEditingContext editingContext, Collection<?> items, Function<Object, IBmTask<?>> taskCreator) Creates anIBmTaskfor each element initemsusingtaskCreator. Then executes aBmCompoundTaskcomprised of the created tasks usingIBmEditingSupportthat corresponds to themodelobject.Note: If for some item no task should be executed,
taskCreatorshell return null. -
executeWizard
public static void executeWizard(org.eclipse.ui.wizards.IWizardDescriptor wizardDescriptor, ISelection selection) Executes the givenwizardDescriptorwith and provides it with givenselection -
getSelectedObjectList
Returns list of target class selected objects fromIStructuredSelection.- Parameters:
selection- the sourceIStructuredSelection, cannot benullclazz- the target selected objects class, cannot benull- Returns:
- the list of target class selected objects, never
null
-