Class KeyAssistDialog
java.lang.Object
org.eclipse.jface.window.Window
org.eclipse.jface.dialogs.PopupDialog
org.eclipse.e4.ui.bindings.internal.KeyAssistDialog
- All Implemented Interfaces:
IShellProvider
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
-
Field Summary
Fields inherited from class org.eclipse.jface.dialogs.PopupDialog
HOVER_SHELLSTYLE, INFOPOPUP_SHELLSTYLE, INFOPOPUPRESIZE_SHELLSTYLE, POPUP_HORIZONTALSPACING, POPUP_IMG_MENU, POPUP_IMG_MENU_DISABLED, POPUP_MARGINHEIGHT, POPUP_MARGINWIDTH, POPUP_VERTICALSPACING
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurred
-
Constructor Summary
ConstructorDescriptionKeyAssistDialog
(IEclipseContext context, KeyBindingDispatcher associatedKeyboard) Constructs a new instance ofKeyAssistDialog
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears out the remembered state of the key assist dialog.boolean
close()
Closes this shell, but first remembers some state of the dialog.boolean
close
(boolean rememberState) Closes this shell, but first remembers some state of the dialog.protected Control
createDialogArea
(Composite parent) Creates the content area for the key assistant.protected Binding
Returns the currently selected binding from the table if the table is not disposedboolean
isShowingBindings
(Collection<Binding> bindings) Tests whether the key assist dialog is currently showing a set of bindings.int
open()
Opens this dialog.int
open
(Collection<Binding> bindings) Opens this dialog with the list of bindings for the user to select from.void
setParentShell
(Shell newParentShell) Exposing this within the keys package.Methods inherited from class org.eclipse.jface.dialogs.PopupDialog
adjustBounds, applyBackgroundColor, applyForegroundColor, configureShell, createContents, createInfoTextArea, createTitleControl, createTitleMenuArea, fillDialogMenu, getBackground, getBackgroundColorExclusions, getDefaultLocation, getDefaultSize, getDialogSettings, getFocusControl, getForeground, getForegroundColorExclusions, getInitialLocation, getInitialSize, getPersistLocation, getPersistSize, hasInfoArea, hasTitleArea, saveDialogBounds, setInfoText, setTabOrder, setTitleText, showDialogMenu
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, create, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, initializeBounds, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setReturnCode, setShellStyle, setWindowManager
-
Constructor Details
-
KeyAssistDialog
Constructs a new instance ofKeyAssistDialog
. When the dialog is first constructed, it contains no widgets. The dialog is first created with no parent. If a parent is required, callsetParentShell()
. Also, between uses, it might be necessary to callsetParentShell()
as well.- Parameters:
context
- The context in which this dialog is created; must not benull
.associatedKeyboard
- The key binding listener for the workbench; must not benull
.
-
-
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 classPopupDialog
- 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
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 classPopupDialog
- Parameters:
parent
- The parent composite to contain the dialog area; must not benull
.- 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 classPopupDialog
- Returns:
- The return code from this dialog.
- See Also:
-
open
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
Exposing this within the keys package.- Overrides:
setParentShell
in classWindow
- Parameters:
newParentShell
- The new parent shell; this value may benull
if there is to be no parent.
-
isShowingBindings
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
Returns the currently selected binding from the table if the table is not disposed- Returns:
- the currently selected binding or
null
-