Class ContextMenuProvider

All Implemented Interfaces:
IContributionItem, IContributionManager, IMenuListener, IMenuManager
Direct Known Subclasses:
PaletteContextMenuProvider

public abstract class ContextMenuProvider extends MenuManager implements IMenuListener
Extends MenuManager to allow populating the menu directly from the manager itself. Using this class is no different than using a standalone MenuManager, and adding a menuAboutToShow listener.
  • Constructor Details

    • ContextMenuProvider

      public ContextMenuProvider(EditPartViewer viewer)
      Constructs a context menu for the specified EditPartViewer.
      Parameters:
      viewer - the editpart viewer
  • Method Details

    • buildContextMenu

      public abstract void buildContextMenu(IMenuManager menu)
      Called when the menu is about to show. Subclasses must implement this method to populate the menu each time it is shown.
      Parameters:
      menu - this parameter is actually this object
    • getViewer

      protected EditPartViewer getViewer()
      Returns the EditPartViewer
      Returns:
      the viewer
    • setViewer

      protected void setViewer(EditPartViewer viewer)
      Sets the editpart viewer. Called during construction.
      Parameters:
      viewer - the viewer