Class QuickMenuCreator


  • public abstract class QuickMenuCreator
    extends Object
    Abstract class that is capable of creating a context menu. It will try and open the menu close to the current selection, or under the mouse pointer if that's not possible.
    Since:
    3.3
    • Constructor Detail

      • QuickMenuCreator

        public QuickMenuCreator()
    • Method Detail

      • createMenu

        public void createMenu()
        Create and open the context menu.
      • fillMenu

        protected abstract void fillMenu​(IMenuManager menu)
        Create the contents of the context menu.
        Parameters:
        menu - the menu to fill
      • computeMenuLocation

        protected Point computeMenuLocation​(Control focus)
        Determine the optimal point for this menu to appear.
        Parameters:
        focus - the focus control
        Returns:
        the optimal placement
        Since:
        3.5
      • computeMenuLocation

        protected Point computeMenuLocation​(StyledText text)
        Hook to compute the menu location if the focus widget is a styled text widget.
        Parameters:
        text - the styled text widget that has the focus
        Returns:
        a widget relative position of the menu to pop up or null if now position inside the widget can be computed
        Since:
        3.5
      • computeMenuLocation

        protected Point computeMenuLocation​(Tree tree)
        Hook to compute the menu location if the focus widget is a tree widget.
        Parameters:
        tree - the tree widget that has the focus
        Returns:
        a widget relative position of the menu to pop up or null if now position inside the widget can be computed
        Since:
        3.5
      • computeMenuLocation

        protected Point computeMenuLocation​(Table table)
        Hook to compute the menu location if the focus widget is a table widget.
        Parameters:
        table - the table widget that has the focus
        Returns:
        a widget relative position of the menu to pop up or null if now position inside the widget can be computed
        Since:
        3.5
      • dispose

        @Deprecated
        public void dispose()
        Deprecated.
        As of 3.5 this is not necessary as the SWT Menu created in createMenu() will be disposed shortly after the SWT.Hide event.
        Dispose of this quick menu creator. Subclasses should ensure that they call this method.