Package org.eclipse.handly.ui.action
Class HistoryDropDownAction<E>
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.handly.ui.action.HistoryDropDownAction<E>
- Type Parameters:
E
- the type of elements managed by the history
- All Implemented Interfaces:
org.eclipse.jface.action.IAction
public class HistoryDropDownAction<E>
extends org.eclipse.jface.action.Action
Shows a history list in a drop-down.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents the underlying history for theHistoryDropDownAction
. -
Field Summary
Fields inherited from interface org.eclipse.jface.action.IAction
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
-
Constructor Summary
ConstructorDescriptionConstructs aHistoryDropDownAction
on the given history. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addMenuEntries
(org.eclipse.jface.action.IMenuManager manager) Allows subclasses to place additional menu entries to the history drop-down.protected void
configureHistoryListAction
(org.eclipse.jface.action.IAction action) Configures the history list action.protected org.eclipse.jface.action.IAction
Returns a 'clear history' action.protected String
Returns the message for the history list dialog.protected String
Returns the title for the history list dialog.protected int
Returns the maximum number of entries in the history drop-down.protected org.eclipse.swt.widgets.Shell
getShell()
Returns the shell to use as the parent shell of the history list dialog.void
run()
Methods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
Methods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
Constructor Details
-
HistoryDropDownAction
Constructs aHistoryDropDownAction
on the given history.- Parameters:
history
- notnull
-
-
Method Details
-
run
public void run()- Specified by:
run
in interfaceorg.eclipse.jface.action.IAction
- Overrides:
run
in classorg.eclipse.jface.action.Action
-
configureHistoryListAction
protected void configureHistoryListAction(org.eclipse.jface.action.IAction action) Configures the history list action. Default implementation does nothing. Subclasses may override (e.g., to set a more specific text or an image for the action).- Parameters:
action
- nevernull
-
getHistoryListDialogTitle
Returns the title for the history list dialog. Default implementation returns a generic title.- Returns:
- the title for the history list dialog (not
null
)
-
getHistoryListDialogMessage
Returns the message for the history list dialog. Default implementation returns a generic message which prompts the user to select the element to open.- Returns:
- the message for the history list dialog (not
null
)
-
getClearHistoryAction
protected org.eclipse.jface.action.IAction getClearHistoryAction()Returns a 'clear history' action. Default implementation returns a generic action, which callsHistoryDropDownAction.History.setHistoryEntries(List)
with an empty list.- Returns:
- the 'clear history' action (may be
null
, in which case no 'clear history' action will be contributed to the history drop-down)
-
addMenuEntries
protected void addMenuEntries(org.eclipse.jface.action.IMenuManager manager) Allows subclasses to place additional menu entries to the history drop-down. Default implementation does nothing.- Parameters:
manager
- nevernull
-
getMaxEntriesInDropDown
protected int getMaxEntriesInDropDown()Returns the maximum number of entries in the history drop-down.- Returns:
- the maximum number of entries in the history drop-down
-
getShell
protected org.eclipse.swt.widgets.Shell getShell()Returns the shell to use as the parent shell of the history list dialog. Default implementation returns the currently active shell.- Returns:
- the shell (may be
null
)
-