Package org.eclipse.handly.ui.action
Class OpenAction
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.jface.action.AbstractAction
-
- org.eclipse.jface.action.Action
-
- org.eclipse.ui.actions.BaseSelectionListenerAction
-
- org.eclipse.handly.ui.action.OpenAction
-
- All Implemented Interfaces:
org.eclipse.jface.action.IAction
,org.eclipse.jface.viewers.ISelectionChangedListener
public class OpenAction extends org.eclipse.ui.actions.BaseSelectionListenerAction
Opens an editor on an applicable element.
-
-
Constructor Summary
Constructors Constructor Description OpenAction(EditorOpener editorOpener)
Constructs an open action with the given editor opener.OpenAction(org.eclipse.ui.IWorkbenchPage page, EditorUtility editorUtility)
Constructs an open action with the given workbench page and the given editor utility; uses a default editor opener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IStatusAcceptor
newStatusAcceptor()
Returns a new instance of the status acceptor for this action.void
run()
For each of the currently selected elements that has acorresponding
editor input, this implementation uses the editor opener to open and reveal the element in an appropriate editor; if an error occurs while opening the editor, it is reported to the status acceptor.protected boolean
updateSelection(org.eclipse.jface.viewers.IStructuredSelection selection)
This implementation returnsfalse
if the given selection isnull
or empty, or if no editor inputcorresponds
to a selected element; otherwise,true
is returned.-
Methods inherited from class org.eclipse.ui.actions.BaseSelectionListenerAction
clearCache, getStructuredSelection, runWithEvent, selectionChanged, selectionChanged
-
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, 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
-
OpenAction
public OpenAction(org.eclipse.ui.IWorkbenchPage page, EditorUtility editorUtility)
Constructs an open action with the given workbench page and the given editor utility; uses a default editor opener.- Parameters:
page
- the workbench page to open the editor in (notnull
)editorUtility
- the editor utility for this action (notnull
)- See Also:
OpenAction(EditorOpener)
-
OpenAction
public OpenAction(EditorOpener editorOpener)
Constructs an open action with the given editor opener.- Parameters:
editorOpener
- the editor opener for this action (notnull
)
-
-
Method Detail
-
run
public void run()
For each of the currently selected elements that has acorresponding
editor input, this implementation uses the editor opener to open and reveal the element in an appropriate editor; if an error occurs while opening the editor, it is reported to the status acceptor.- Specified by:
run
in interfaceorg.eclipse.jface.action.IAction
- Overrides:
run
in classorg.eclipse.jface.action.Action
- See Also:
EditorOpener.open(Object, boolean, boolean)
,newStatusAcceptor()
-
updateSelection
protected boolean updateSelection(org.eclipse.jface.viewers.IStructuredSelection selection)
This implementation returnsfalse
if the given selection isnull
or empty, or if no editor inputcorresponds
to a selected element; otherwise,true
is returned.- Overrides:
updateSelection
in classorg.eclipse.ui.actions.BaseSelectionListenerAction
-
newStatusAcceptor
protected IStatusAcceptor newStatusAcceptor()
Returns a new instance of the status acceptor for this action.A default status acceptor logs each status to the error log and displays an error dialog when done and at least one status was accepted.
- Returns:
- a new status acceptor (never
null
)
-
-