Class AbstractActionsGroup
- java.lang.Object
-
- com._1c.g5.v8.dt.form.ui.editor.actionsgroup.AbstractActionsGroup
-
- Direct Known Subclasses:
FormActionsGroup
public abstract class AbstractActionsGroup extends Object
The abstract class for associations of actions about one area of responsibility.
-
-
Field Summary
Fields Modifier and Type Field Description protected ISelectionProvider
provider
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractActionsGroup(ISelectionProvider provider)
The abstract constructor of actions group.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
calculateActionsState(IStructuredSelection selection)
Method for recalculation actions state, at change selection.abstract void
contributeToMenu(org.eclipse.jface.action.IMenuManager manager)
This method contribute to context menuorg.eclipse.jface.action.MenuManager
contributeToMenu(org.eclipse.swt.widgets.Control control)
This method creates a context menu for control and contribute itsabstract void
contributeToToolbar(org.eclipse.jface.action.IToolBarManager manager)
This method contribute to toolbarorg.eclipse.jface.action.ToolBarManager
contributeToToolbar(org.eclipse.swt.widgets.ToolBar toolbar)
This method contribute to toolbarvoid
dispose()
Clears allocated resources.protected IStructuredSelection
getSelection()
The method returns current selection if not have return empty selectionprotected <T> T
getSingleObject(Class<T> clazz)
The method return single object byClass
.protected boolean
isEmptySelection()
The method checks size of selectionprotected boolean
isMultiSelection()
The method checks size of selectionvoid
refresh()
Refresh action stateprotected void
selectionChanged(IStructuredSelection selection)
The method is called at change of the selectionprotected void
setSelection(IStructuredSelection selection)
The method convert selection if it is needed
-
-
-
Field Detail
-
provider
protected ISelectionProvider provider
-
-
Constructor Detail
-
AbstractActionsGroup
protected AbstractActionsGroup(ISelectionProvider provider)
The abstract constructor of actions group.- Parameters:
provider
- the selection provider, cannot benull
-
-
Method Detail
-
dispose
public void dispose()
Clears allocated resources. Must be called explicitly.
-
refresh
public void refresh()
Refresh action state
-
setSelection
protected void setSelection(IStructuredSelection selection)
The method convert selection if it is needed- Parameters:
selection
- the selection for convert
-
getSelection
protected IStructuredSelection getSelection()
The method returns current selection if not have return empty selection- Returns:
- the current selection
-
isEmptySelection
protected boolean isEmptySelection()
The method checks size of selection- Returns:
- return
true
if selection is empty (size == 0), returnfalse
if selection is not empty
-
isMultiSelection
protected boolean isMultiSelection()
The method checks size of selection- Returns:
- return
true
if selection contains more than one object, returnfalse
the otherwise
-
getSingleObject
protected <T> T getSingleObject(Class<T> clazz)
The method return single object byClass
. if selection has many object or it is empty then returnsnull
- Type Parameters:
T
- - the searching object type.- Parameters:
clazz
- the class of searching.- Returns:
- T the searching object. This method can returns
null
ifgetSelection()
is empty or has many objects.null
returns if selection does not contain object ofT
type.
-
selectionChanged
protected final void selectionChanged(IStructuredSelection selection)
The method is called at change of the selection- Parameters:
selection
- the new selection
-
calculateActionsState
protected abstract void calculateActionsState(IStructuredSelection selection)
Method for recalculation actions state, at change selection. This method is called when change selection.- Parameters:
selection
- the changed selection
-
contributeToToolbar
public abstract void contributeToToolbar(org.eclipse.jface.action.IToolBarManager manager)
This method contribute to toolbar- Parameters:
manager
- the toolbar manager
-
contributeToMenu
public abstract void contributeToMenu(org.eclipse.jface.action.IMenuManager manager)
This method contribute to context menu- Parameters:
manager
- the context menu manager
-
contributeToToolbar
public org.eclipse.jface.action.ToolBarManager contributeToToolbar(org.eclipse.swt.widgets.ToolBar toolbar)
This method contribute to toolbar- Parameters:
toolbar
- the toolbar- Returns:
- the toolbar contribution manager, never
null
-
contributeToMenu
public org.eclipse.jface.action.MenuManager contributeToMenu(org.eclipse.swt.widgets.Control control)
This method creates a context menu for control and contribute its- Parameters:
toolbar
- the control for which creates context menu- Returns:
- the menu contribution manager, never
null
-
-