org.eclipse.graphiti.ui.internal.util.ui

## Class PopupMenu

- java.lang.Object
- - org.eclipse.graphiti.ui.internal.util.ui.PopupMenu

    public class PopupMenu
    extends java.lang.Object

A simple pop-up menu with a list from which the user can select one item.

The `show()` method returns false if the user cancelled the gesture or clicked outside the popup.

The `getResult()` method returns the result which is the object from the content list that the user selected, or in the case of cascading menus, a list of the results from each popup.

### Nested Class Summary

Nested Classes
`static class` `PopupMenu.CascadingMenu` An instance of this class can be created to add a submenu to a menu item in a `PopupMenu`.

### Constructor Summary

Constructors
Constructor and Description
`PopupMenu(java.util.List<?> aContent, ILabelProvider aLabelProvider)` Creates a new `PopupMenu`.

### Method Summary

All Methods Instance Methods Concrete Methods
`java.lang.Object` `getResult()` Gets the result which is the object from the content list that the user selected, or in the case of cascading menus, a list of the results from each popup.
`void` `setContent(java.util.List<?> aContent)` Sets the content.
`void` `setLabelProvider(ILabelProvider aLabelProvider)` Sets the labelProvider.
`boolean` `show(Control parent)` Shows the popup menu and sets the resultList selected by the user.

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

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

### Constructor Detail

#### PopupMenu

    public PopupMenu(java.util.List<?> aContent,
                     ILabelProvider aLabelProvider)

Creates a new `PopupMenu`.

Parameters:
  `aContent` - the content for the menu, each object in the list represents a menu item
  `aLabelProvider` - the label provider used to provide the text for each object in the content list

### Method Detail

#### show

    public boolean show(Control parent)

Shows the popup menu and sets the resultList selected by the user.

Parameters:
  `parent` - menu will be shown in this parent Control
Returns:
  true if this succeeded, false otherwise (e.g. if the user cancelled the gesture).

#### setContent

    public void setContent(java.util.List<?> aContent)

Sets the content.

Parameters:
  `aContent` - The content of this menu. Each entry in the list becomes a menu item.

#### setLabelProvider

    public void setLabelProvider(ILabelProvider aLabelProvider)

Sets the labelProvider.

Parameters:
  `aLabelProvider` - Provides the text and icon for each menu item.

#### getResult

    public java.lang.Object getResult()

Gets the result which is the object from the content list that the user selected, or in the case of cascading menus, a list of the results from each popup.

Returns:
  Returns the resultList.