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
Nested Classes Modifier and Type Class Description static class
HistoryDropDownAction.History<E>
Represents the underlying history for theHistoryDropDownAction
.
-
Constructor Summary
Constructors Constructor Description HistoryDropDownAction(HistoryDropDownAction.History<E> history)
Constructs aHistoryDropDownAction
on the given history.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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
getClearHistoryAction()
Returns a 'clear history' action.protected java.lang.String
getHistoryListDialogMessage()
Returns the message for the history list dialog.protected java.lang.String
getHistoryListDialogTitle()
Returns the title for the history list dialog.protected int
getMaxEntriesInDropDown()
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
-
-
-
-
Constructor Detail
-
HistoryDropDownAction
public HistoryDropDownAction(HistoryDropDownAction.History<E> history)
Constructs aHistoryDropDownAction
on the given history.- Parameters:
history
- notnull
-
-
Method Detail
-
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
protected java.lang.String 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
protected java.lang.String 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
)
-
-