Package org.eclipse.e4.core.commands.internal

# Class HandlerServiceImpl

java.lang.Object
org.eclipse.e4.core.commands.internal.HandlerServiceImpl

All Implemented Interfaces:
  `EHandlerService`

public class HandlerServiceImpl extends Object implements EHandlerService

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CAN_EXECUTE`
`static final String`
`H_ID`
`static final String`
`HANDLER_EXCEPTION`
`static ContextFunction`
`handlerGenerator`
`static final String`
`NOT_HANDLED`
`static final String`
`PARM_MAP`
`static final String`
`STATIC_CONTEXT`

## Constructor Summary

Constructors
Constructor
Description
`HandlerServiceImpl()`

## Method Summary

Modifier and Type
Method
Description
`void`
`activateHandler(String commandId, Object handler)`
Makes the passed `handler` active for the command with the passed `commandId`.
`boolean`
`canExecute(ParameterizedCommand command)`
Tests if the active handler associated with the passed `command` can be executed.
`boolean`
`canExecute(ParameterizedCommand command, IEclipseContext staticContext)`
Check if a command can be executed.
`void`
`deactivateHandler(String commandId, Object handler)`
Deactivates the passed `handler` from the command with the passed id.
`Object`
`executeHandler(ParameterizedCommand command)`
Executes the active handler of the passed `command`.
`Object`
`executeHandler(ParameterizedCommand command, IEclipseContext staticContext)`
Execute a handler for the command.
`IEclipseContext`
`getContext()`
`IEclipseContext`
`getExecutionContext()`
`static IHandler`
`getHandler(String commandId)`
`static Object`
`lookUpHandler(IEclipseContext context, String commandId)`
`static org.eclipse.e4.core.commands.internal.HandlerServiceImpl.ExecutionContexts`
`pop()`
`static void`
`push(IEclipseContext ctx, IEclipseContext staticCtx)`
`void`
`setContext(IEclipseContext c)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### H_ID

public static final String H_ID

See Also:
  - Constant Field Values

### PARM_MAP

public static final String PARM_MAP

See Also:
  - Constant Field Values

### CAN_EXECUTE

public static final String CAN_EXECUTE

See Also:
  - Constant Field Values

### NOT_HANDLED

public static final String NOT_HANDLED

See Also:
  - Constant Field Values

### STATIC_CONTEXT

public static final String STATIC_CONTEXT

See Also:
  - Constant Field Values

### HANDLER_EXCEPTION

public static final String HANDLER_EXCEPTION

See Also:
  - Constant Field Values

### handlerGenerator

public static ContextFunction handlerGenerator

## Constructor Details

### HandlerServiceImpl

public HandlerServiceImpl()

## Method Details

### getHandler

public static IHandler getHandler(String commandId)

### push

public static void push(IEclipseContext ctx, IEclipseContext staticCtx)

### pop

public static org.eclipse.e4.core.commands.internal.HandlerServiceImpl.ExecutionContexts pop()

### lookUpHandler

public static Object lookUpHandler(IEclipseContext context, String commandId)

Parameters:
  `context` - the context to start the lookup process
Returns:
  a handler, or `null`

### activateHandler

public void activateHandler(String commandId, Object handler)
Description copied from interface: `EHandlerService`
Makes the passed `handler` active for the command with the passed `commandId`.

Specified by:
  `activateHandler` in interface `EHandlerService`
Parameters:
  `commandId` - Must not be `null`
  `handler` - Must not be `null`

### canExecute

public boolean canExecute(ParameterizedCommand command)
Description copied from interface: `EHandlerService`
Tests if the active handler associated with the passed `command` can be executed.

Specified by:
  `canExecute` in interface `EHandlerService`
Parameters:
  `command` - Must not be `null`
Returns:
  true of the handler can be executed, false if it cannot be executed or if no handler is active for the passed command.

### canExecute

public boolean canExecute(ParameterizedCommand command, IEclipseContext staticContext)
Description copied from interface: `EHandlerService`
Check if a command can be executed.

Specified by:
  `canExecute` in interface `EHandlerService`
Parameters:
  `command` - Must not be `null`.
  `staticContext` - Must not be `null`. You must dispose your context when you are done.
Returns:
  true if the command can be executed.

### deactivateHandler

public void deactivateHandler(String commandId, Object handler)
Description copied from interface: `EHandlerService`
Deactivates the passed `handler` from the command with the passed id.

Specified by:
  `deactivateHandler` in interface `EHandlerService`
Parameters:
  `commandId` - Must not be `null`
  `handler` - Must not be `null`

### executeHandler

public Object executeHandler(ParameterizedCommand command)
Description copied from interface: `EHandlerService`
Executes the active handler of the passed `command`.

Specified by:
  `executeHandler` in interface `EHandlerService`
Parameters:
  `command` - Must not be `null`
Returns:
  the return value of the handler, could be null

### executeHandler

public Object executeHandler(ParameterizedCommand command, IEclipseContext staticContext)
Description copied from interface: `EHandlerService`
Execute a handler for the command.

Specified by:
  `executeHandler` in interface `EHandlerService`
Parameters:
  `command` - Must not be `null`
  `staticContext` - Must not be `null`. You must dispose your context when you are done.
Returns:
  the command return value.

### setContext

@Inject public void setContext(IEclipseContext c)

### getContext

public IEclipseContext getContext()

### getExecutionContext

public IEclipseContext getExecutionContext()