Class AbstractActionsGroup

  • Direct Known Subclasses:
    FormActionsGroup

    public abstract class AbstractActionsGroup
    extends Object
    The abstract class for associations of actions about one area of responsibility.
    • Constructor Detail

      • AbstractActionsGroup

        protected AbstractActionsGroup​(ISelectionProvider provider)
        The abstract constructor of actions group.
        Parameters:
        provider - the selection provider, cannot be null
    • 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), return false 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, return false the otherwise
      • getSingleObject

        protected <T> T getSingleObject​(Class<T> clazz)
        The method return single object by Class. if selection has many object or it is empty then returns null
        Type Parameters:
        T - - the searching object type.
        Parameters:
        clazz - the class of searching.
        Returns:
        T the searching object. This method can returns null if getSelection() is empty or has many objects. null returns if selection does not contain object of T 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