Class AbstractListElementHandler
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.core.commands.AbstractHandler
-
- com._1c.g5.v8.dt.ui.commands.list.AbstractListElementHandler
-
- All Implemented Interfaces:
org.eclipse.core.commands.IHandler
,org.eclipse.core.commands.IHandler2
- Direct Known Subclasses:
AbstractMoveElementHandler
,OpenEditorHandler
,OpenWizardHandler
,SortListHandler
public abstract class AbstractListElementHandler extends org.eclipse.core.commands.AbstractHandler
Abstract handler that works with single element or a collection of metadata objects in a list: Catalogs, Documents, Attributes, Commands, etc.Contains support methods to get selected element or a collection of elements, get parent container and containing list.
-
-
Constructor Summary
Constructors Constructor Description AbstractListElementHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.emf.ecore.EStructuralFeature
findReference(org.eclipse.emf.ecore.EObject parent, org.eclipse.emf.ecore.EObject child)
Find a reference from the provided parent model object to the provided child.protected org.eclipse.emf.ecore.EStructuralFeature
getContainingFeature(org.eclipse.core.commands.ExecutionEvent event)
Returns containing feature for current selected metadata element.protected org.eclipse.emf.ecore.EStructuralFeature
getContainingFeature(org.eclipse.emf.ecore.EObject element)
Returns containing feature for the provided metadata element.protected org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject>
getContainingList(org.eclipse.core.commands.ExecutionEvent event)
Returns current selected metadata element container list of elements: for Catalog returns list of Catalogs, for Document list of Documents, etc.protected org.eclipse.emf.ecore.EObject
getElementContainer(org.eclipse.emf.ecore.EObject element)
Returns the provided element metadata container.protected org.eclipse.emf.ecore.EObject
getSelectedElement(org.eclipse.core.commands.ExecutionEvent event)
Returns current selected metadata element: Catalog, Document, Attribute, Command etc.protected org.eclipse.emf.ecore.EObject
getSelectedElementContainer(org.eclipse.core.commands.ExecutionEvent event)
Returns current selected element metadata container.protected List<org.eclipse.emf.ecore.EObject>
getSelectedElements(org.eclipse.core.commands.ExecutionEvent event)
Returns a collection of selected metadata elements: Catalog, Document, Attribute, Command etc.protected ISelection
getSelection(org.eclipse.core.commands.ExecutionEvent event)
Returns the selection by the givenevent
.protected void
setLookupChildren(boolean lookupChildren)
Sets the given value to the "lookupChildren" flag.-
Methods inherited from class org.eclipse.core.commands.AbstractHandler
addHandlerListener, dispose, fireHandlerChanged, hasListeners, isEnabled, isHandled, removeHandlerListener, setBaseEnabled, setEnabled
-
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
-
-
-
Method Detail
-
getSelectedElement
protected org.eclipse.emf.ecore.EObject getSelectedElement(org.eclipse.core.commands.ExecutionEvent event)
Returns current selected metadata element: Catalog, Document, Attribute, Command etc. Method takes first of selected elements. Can returnnull
.- Parameters:
event
- the handler execution event, cannot benull
- Returns:
- current selected metadata element or
null
if cannot get
-
getSelectedElements
protected List<org.eclipse.emf.ecore.EObject> getSelectedElements(org.eclipse.core.commands.ExecutionEvent event)
Returns a collection of selected metadata elements: Catalog, Document, Attribute, Command etc. Can return empty collection.If the "lookupChildren" flag is
true
then it returns a collection of children elements for adapable selected objects otherwise returnsEObject
adapters.- Parameters:
event
- the handler execution event, cannot benull
- Returns:
- a collection of selected metadata elements, never
null
- See Also:
IAdaptable.getAdapter(Class)
-
getSelectedElementContainer
protected org.eclipse.emf.ecore.EObject getSelectedElementContainer(org.eclipse.core.commands.ExecutionEvent event)
Returns current selected element metadata container. Can returnnull
.- Parameters:
event
- the handler execution event, cannot benull
- Returns:
- a selected element container or
null
if cannot get
-
getElementContainer
protected org.eclipse.emf.ecore.EObject getElementContainer(org.eclipse.emf.ecore.EObject element)
Returns the provided element metadata container. Can returnnull
.- Parameters:
element
- the element, cannot benull
- Returns:
- a provided element container or
null
if cannot get
-
getContainingList
protected org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> getContainingList(org.eclipse.core.commands.ExecutionEvent event)
Returns current selected metadata element container list of elements: for Catalog returns list of Catalogs, for Document list of Documents, etc. Can returnnull
.- Parameters:
event
- the handler execution event, cannot benull
- Returns:
- a container list of elements or
null
if cannot get
-
getContainingFeature
protected org.eclipse.emf.ecore.EStructuralFeature getContainingFeature(org.eclipse.core.commands.ExecutionEvent event)
Returns containing feature for current selected metadata element. Can returnnull
.- Parameters:
event
- the handler execution event, cannot benull
- Returns:
- a containing feature or
null
if cannot get
-
getContainingFeature
protected org.eclipse.emf.ecore.EStructuralFeature getContainingFeature(org.eclipse.emf.ecore.EObject element)
Returns containing feature for the provided metadata element. Can returnnull
.- Parameters:
element
- the element, cannot benull
- Returns:
- a containing feature or
null
if cannot get
-
findReference
protected org.eclipse.emf.ecore.EStructuralFeature findReference(org.eclipse.emf.ecore.EObject parent, org.eclipse.emf.ecore.EObject child)
Find a reference from the provided parent model object to the provided child.- Parameters:
parent
- the parent object, cannot benull
child
- the child object, cannot benull
- Returns:
- a reference from the provided parent to child or
null
if not found
-
getSelection
protected ISelection getSelection(org.eclipse.core.commands.ExecutionEvent event)
Returns the selection by the givenevent
.- Parameters:
event
- the handler execution event, cannot benull
- Returns:
- the selection or
null
if there isn't any
-
setLookupChildren
protected void setLookupChildren(boolean lookupChildren)
Sets the given value to the "lookupChildren" flag.- Parameters:
lookupChildren
- the new value of the "lookupChildren" flag to set- See Also:
getSelectedElements(ExecutionEvent)
-
-