Class KeyAssistDialog

All Implemented Interfaces:
IShellProvider

public class KeyAssistDialog extends PopupDialog

A dialog displaying a list of key bindings. The dialog will execute a command if it is selected.

The methods on this class are not thread-safe and must be run from the UI thread.

Since:
3.1
  • Constructor Details

    • KeyAssistDialog

      public KeyAssistDialog(IEclipseContext context, KeyBindingDispatcher associatedKeyboard)
      Constructs a new instance of KeyAssistDialog. When the dialog is first constructed, it contains no widgets. The dialog is first created with no parent. If a parent is required, call setParentShell(). Also, between uses, it might be necessary to call setParentShell() as well.
      Parameters:
      context - The context in which this dialog is created; must not be null.
      associatedKeyboard - The key binding listener for the workbench; must not be null.
  • Method Details

    • clearRememberedState

      public void clearRememberedState()
      Clears out the remembered state of the key assist dialog. This includes its width, as well as the selected binding.
    • close

      public boolean close()
      Closes this shell, but first remembers some state of the dialog. This way it will have a response if asked to open the dialog again or if asked to open the keys preference page. This does not remember the internal state.
      Overrides:
      close in class PopupDialog
      Returns:
      Whether the shell was already closed.
    • close

      public boolean close(boolean rememberState)
      Closes this shell, but first remembers some state of the dialog. This way it will have a response if asked to open the dialog again or if asked to open the keys preference page.
      Parameters:
      rememberState - Whether the internal state should be remembered.
      Returns:
      Whether the shell was already closed.
    • createDialogArea

      protected Control createDialogArea(Composite parent)
      Creates the content area for the key assistant. This creates a table and places it inside the composite. The composite will contain a list of all the key bindings.
      Overrides:
      createDialogArea in class PopupDialog
      Parameters:
      parent - The parent composite to contain the dialog area; must not be null.
      Returns:
      the dialog area control
    • open

      public int open()
      Opens this dialog. This method can be called multiple times on the same dialog. This only opens the dialog if there is no remembered state; if there is remembered state, then it tries to open the preference page instead.
      Overrides:
      open in class PopupDialog
      Returns:
      The return code from this dialog.
      See Also:
    • open

      public int open(Collection<Binding> bindings)
      Opens this dialog with the list of bindings for the user to select from.
      Returns:
      The return code from this dialog.
      Since:
      3.3
    • setParentShell

      public void setParentShell(Shell newParentShell)
      Exposing this within the keys package.
      Overrides:
      setParentShell in class Window
      Parameters:
      newParentShell - The new parent shell; this value may be null if there is to be no parent.
    • isShowingBindings

      public boolean isShowingBindings(Collection<Binding> bindings)
      Tests whether the key assist dialog is currently showing a set of bindings.
      Parameters:
      bindings - A set of conflicts or partial matches.
      Returns:
      Whether the key assist dialog shows the bindings.
    • getSelectedBinding

      protected Binding getSelectedBinding()
      Returns the currently selected binding from the table if the table is not disposed
      Returns:
      the currently selected binding or null