public class HandlerUtil extends Object
Note: this class should not be instantiated or extended by clients.
Constructor and Description |
---|
HandlerUtil() |
Modifier and Type | Method and Description |
---|---|
static Collection |
getActiveContexts(ExecutionEvent event)
Return the active contexts.
|
static Collection |
getActiveContextsChecked(ExecutionEvent event)
Return the active contexts.
|
static IEditorPart |
getActiveEditor(ExecutionEvent event)
Return the active editor.
|
static IEditorPart |
getActiveEditorChecked(ExecutionEvent event)
Return the active editor.
|
static String |
getActiveEditorId(ExecutionEvent event)
Return the part id of the active editor.
|
static String |
getActiveEditorIdChecked(ExecutionEvent event)
Return the part id of the active editor.
|
static IEditorInput |
getActiveEditorInput(ExecutionEvent event)
Return the input of the active editor.
|
static IEditorInput |
getActiveEditorInputChecked(ExecutionEvent event)
Return the input of the active editor.
|
static ISelection |
getActiveMenuEditorInput(ExecutionEvent event)
Return the active menu editor input, if available.
|
static ISelection |
getActiveMenuEditorInputChecked(ExecutionEvent event)
Return the active menu editor input.
|
static Collection |
getActiveMenus(ExecutionEvent event)
Return the menu IDs that were applied to the registered context menu.
|
static Collection |
getActiveMenusChecked(ExecutionEvent event)
Return the menu IDs that were applied to the registered context menu.
|
static ISelection |
getActiveMenuSelection(ExecutionEvent event)
Return the active menu selection.
|
static ISelection |
getActiveMenuSelectionChecked(ExecutionEvent event)
Return the active menu selection.
|
static IWorkbenchPart |
getActivePart(ExecutionEvent event)
Return the active part.
|
static IWorkbenchPart |
getActivePartChecked(ExecutionEvent event)
Return the active part.
|
static String |
getActivePartId(ExecutionEvent event)
Return the part id of the active part.
|
static String |
getActivePartIdChecked(ExecutionEvent event)
Return the part id of the active part.
|
static Shell |
getActiveShell(ExecutionEvent event)
Return the active shell.
|
static Shell |
getActiveShellChecked(ExecutionEvent event)
Return the active shell.
|
static IWorkbenchSite |
getActiveSite(ExecutionEvent event)
Return the active part site.
|
static IWorkbenchSite |
getActiveSiteChecked(ExecutionEvent event)
Return the active part site.
|
static IWorkbenchWindow |
getActiveWorkbenchWindow(ExecutionEvent event)
Return the active workbench window.
|
static IWorkbenchWindow |
getActiveWorkbenchWindowChecked(ExecutionEvent event)
Return the active workbench window.
|
static ISelection |
getCurrentSelection(ExecutionEvent event)
Return the current selection.
|
static ISelection |
getCurrentSelectionChecked(ExecutionEvent event)
Return the current selection.
|
static IStructuredSelection |
getCurrentStructuredSelection(ExecutionEvent event)
Return the current structured selection, or
StructuredSelection.EMPTY
if the current selection is not a structured selection or null . |
static Object |
getShowInInput(ExecutionEvent event)
Return the ShowInContext input.
|
static Object |
getShowInInputChecked(ExecutionEvent event)
Return the ShowInContext input.
|
static ISelection |
getShowInSelection(ExecutionEvent event)
Return the ShowInContext selection.
|
static ISelection |
getShowInSelectionChecked(ExecutionEvent event)
Return the ShowInContext selection.
|
static Object |
getVariable(ExecutionEvent event,
String name)
Extract the variable.
|
static Object |
getVariable(Object context,
String name)
Extract the variable.
|
static Object |
getVariableChecked(ExecutionEvent event,
String name)
Extract the variable.
|
static boolean |
matchesRadioState(ExecutionEvent event)
Checks whether the radio state of the command is same as the radio state
parameter's value
|
static boolean |
toggleCommandState(Command command)
Toggles the command's state.
|
static void |
updateRadioState(Command command,
String newState)
Updates the radio state of the command to the given value
|
public static Object getVariable(ExecutionEvent event, String name)
event
- The execution event that contains the application contextname
- The variable name to extract.null
if it could not be found.public static Object getVariableChecked(ExecutionEvent event, String name) throws ExecutionException
event
- The execution event that contains the application contextname
- The variable name to extract.null
.ExecutionException
- if the variable is not found.public static Object getVariable(Object context, String name)
context
- The IEvaluationContext or null
name
- The variable name to extract.null
if it could not be found.public static Collection getActiveContexts(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static Collection getActiveContextsChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the context variable is not found.public static Shell getActiveShell(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static Shell getActiveShellChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the active shell variable is not found.public static IWorkbenchWindow getActiveWorkbenchWindow(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static IWorkbenchWindow getActiveWorkbenchWindowChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the active workbench window variable is not found.public static IEditorPart getActiveEditor(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static IEditorPart getActiveEditorChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the active editor variable is not found.public static String getActiveEditorId(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static String getActiveEditorIdChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the active editor id variable is not found.public static IEditorInput getActiveEditorInput(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static IEditorInput getActiveEditorInputChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the active editor input variable is not found.public static IWorkbenchPart getActivePart(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static IWorkbenchPart getActivePartChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the active part variable is not found.public static String getActivePartId(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static String getActivePartIdChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the active part id variable is not found.public static IWorkbenchSite getActiveSite(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static IWorkbenchSite getActiveSiteChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the active part site variable is not found.public static ISelection getCurrentSelection(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static IStructuredSelection getCurrentStructuredSelection(ExecutionEvent event)
StructuredSelection.EMPTY
if the current selection is not a structured selection or null
.event
- The execution event that contains the application contextStructuredSelection.EMPTY
.public static ISelection getCurrentSelectionChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the current selection variable is not found.public static Collection getActiveMenus(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static Collection getActiveMenusChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the active menus variable is not found.public static ISelection getActiveMenuSelection(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static ISelection getActiveMenuSelectionChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the active menu selection variable is not found.public static ISelection getActiveMenuEditorInput(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static ISelection getActiveMenuEditorInputChecked(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contextnull
.ExecutionException
- If the active menu editor input variable is not found.public static ISelection getShowInSelection(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static ISelection getShowInSelectionChecked(ExecutionEvent event) throws ExecutionException
null
.event
- The execution event that contains the application contextnull
.ExecutionException
- If the show in selection variable is not found.public static Object getShowInInput(ExecutionEvent event)
event
- The execution event that contains the application contextnull
.public static Object getShowInInputChecked(ExecutionEvent event) throws ExecutionException
null
.event
- The execution event that contains the application contextnull
.ExecutionException
- If the show in input variable is not found.public static boolean toggleCommandState(Command command) throws ExecutionException
command
- The command whose state needs to be toggledExecutionException
- When the command doesn't contain the toggle state or when the state doesn't contain a boolean valuepublic static boolean matchesRadioState(ExecutionEvent event) throws ExecutionException
event
- The execution event that contains the application contexttrue
whe the values are same, false
otherwiseExecutionException
- When the command doesn't have the radio state or the event
doesn't have the radio state parameterpublic static void updateRadioState(Command command, String newState) throws ExecutionException
command
- the command whose state should be updatednewState
- the new stateExecutionException
- When the command doesn't have a radio state
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.