Package org.eclipse.handly.ui.outline

## Class OutlineContextMenuContribution

- java.lang.Object
- - org.eclipse.handly.ui.outline.OutlineContribution
  - - org.eclipse.handly.ui.outline.OutlineContextMenuContribution

- All Implemented Interfaces:
    `IOutlineContribution`

      public class OutlineContextMenuContribution
      extends OutlineContribution

  A base class for outline context menu contributions.

  Contributes an empty menu which has no id and is not eligible for extension. Subclasses may override corresponding methods to configure the menu as necessary.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `OutlineContextMenuContribution()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `contextMenuAboutToShow​(org.eclipse.jface.action.IMenuManager manager)` | Notifies that the context menu of the outline page is about to be shown by the given menu manager.
    `void` | `dispose()` | Disposes of this contribution.
    `protected java.lang.String` | `getContextMenuExtensionId()` | Returns the unique id to use for registration the context menu with the workbench, or `null` if the menu is not eligible for extension.
    `protected java.lang.String` | `getContextMenuId()` | Returns the id of the context menu manager, or `null` if the menu has no id.
    `void` | `init​(ICommonOutlinePage outlinePage)` | Initializes this contribution.

    - ### Methods inherited from class org.eclipse.handly.ui.outline.OutlineContribution

      `getOutlinePage`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OutlineContextMenuContribution

          public OutlineContextMenuContribution()

  - ### Method Detail

    - #### init

          public void init​(ICommonOutlinePage outlinePage)

      Initializes this contribution. This method is called after the outline page's tree viewer has been created.

      This method may be extended by subclasses. Subclasses must call the superclass implementation.

      `OutlineContextMenuContribution` extends this method to create a context menu for the outline page's tree viewer. The menu will have id as computed by `getContextMenuId()` and will invoke `contextMenuAboutToShow(IMenuManager)` when it is about to be shown. If an `extension id` is provided, the menu will be registered with the workbench for extension.

      Specified by:
        `init` in interface `IOutlineContribution`
      Overrides:
        `init` in class `OutlineContribution`
      Parameters:
        `outlinePage` - the contribution's outline page (never `null`)

    - #### dispose

          public void dispose()

      Description copied from class: `OutlineContribution`
      Disposes of this contribution. Implementors should clean up any resources associated with this contribution. Note that there is no guarantee that `init()` has been called. This method has no effect if this contribution has already been disposed.

      This method may be extended by subclasses. Subclasses must call the superclass implementation.

      Specified by:
        `dispose` in interface `IOutlineContribution`
      Overrides:
        `dispose` in class `OutlineContribution`

    - #### getContextMenuId

          protected java.lang.String getContextMenuId()

      Returns the id of the context menu manager, or `null` if the menu has no id.

      Default implementation returns `null`. Subclasses may override this method.

    - #### getContextMenuExtensionId

          protected java.lang.String getContextMenuExtensionId()

      Returns the unique id to use for registration the context menu with the workbench, or `null` if the menu is not eligible for extension.

      Default implementation returns `null`. Subclasses may override this method.

    - #### contextMenuAboutToShow

          protected void contextMenuAboutToShow​(org.eclipse.jface.action.IMenuManager manager)

      Notifies that the context menu of the outline page is about to be shown by the given menu manager.

      Default implementation contributes `IWorkbenchActionConstants.MB_ADDITIONS` group if the context menu was registered with the workbench for extension. Subclasses may extend this method and contribute other items.

      Parameters:
        `manager` - the menu manager (never `null`)