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 void
executeAsComplexTask
(IBmEditingContext editingContext, Collection<?> items, Function<Object, IBmTask<?>> taskCreator) static void
executeWizard
(org.eclipse.ui.wizards.IWizardDescriptor wizardDescriptor, ISelection selection) Executes the givenwizardDescriptor
with and provides it with givenselection
static IBmEditingContext
getEditingContext
(ISelection selection, org.eclipse.emf.ecore.EObject model) ObtainsIBmEditingContext
for a givenselection
.static org.eclipse.emf.ecore.EObject
getEObject
(ISelection selection) ObtainsEObject
from 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) ObtainsEList
for a givenmodel
,feature
andselection
.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) ObtainsEList
corresponding to a givenmodel
,feature
andelement
.static <T> List<T>
getSelectedObjectList
(IStructuredSelection selection, Class<T> clazz) Returns list of target class selected objects fromIStructuredSelection
.
-
Method Details
-
getEObject
ObtainsEObject
from a given selection.- Parameters:
selection
- selection to obtainEObject
from.- Returns:
- obtained
EObject
ornull
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) ObtainsEList
for a givenmodel
,feature
andselection
.- Parameters:
model
- model to obtainEList
from.feature
- feature to obtainEList
from.selection
- selection to obtainEList
from.- Returns:
- obtained
EList
ornull
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) ObtainsEList
corresponding to a givenmodel
,feature
andelement
.- Parameters:
model
- model to obtainEList
from.feature
- feature to obtainEList
from.element
- element to obtainEList
from.- Returns:
- obtained
EList
ornull
if no list could be obtained.
-
getEditingContext
public static IBmEditingContext getEditingContext(ISelection selection, org.eclipse.emf.ecore.EObject model) ObtainsIBmEditingContext
for a givenselection
.- Parameters:
selection
- selection to obtainIBmEditingContext
from.model
- the model object.- Returns:
- obtained
IBmEditingContext
ornull
if no executor could be obtained.
-
executeAsComplexTask
public static void executeAsComplexTask(IBmEditingContext editingContext, Collection<?> items, Function<Object, IBmTask<?>> taskCreator) Creates anIBmTask
for each element initems
usingtaskCreator
. Then executes aBmCompoundTask
comprised of the created tasks usingIBmEditingSupport
that corresponds to themodel
object.Note: If for some item no task should be executed,
taskCreator
shell return null. -
executeWizard
public static void executeWizard(org.eclipse.ui.wizards.IWizardDescriptor wizardDescriptor, ISelection selection) Executes the givenwizardDescriptor
with and provides it with givenselection
-
getSelectedObjectList
Returns list of target class selected objects fromIStructuredSelection
.- Parameters:
selection
- the sourceIStructuredSelection
, cannot benull
clazz
- the target selected objects class, cannot benull
- Returns:
- the list of target class selected objects, never
null
-