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.
-
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
ConstructorDescriptionOpenAction
(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
Modifier and TypeMethodDescriptionprotected IStatusAcceptor
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
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
Constructor Details
-
OpenAction
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
Constructs an open action with the given editor opener.- Parameters:
editorOpener
- the editor opener for this action (notnull
)
-
-
Method Details
-
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:
-
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
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
)
-