Eclipse Platform
2.0

org.eclipse.ui
Interface IKeyBindingService


public interface IKeyBindingService

The key binding service is responsible for invoking an action when the action's sequence of accelerator keys is pressed. The accelerator key sequence assigned to an action is defined by the extension point org.eclipse.ui.acceleratorSets and the active accelerator configuration choosen by the user.

A participating workbench part is responsible to register all its actions with the service. The part is also responsible to set the current scope.

This interface is not intended to be implemented or extended by clients.

Since:
2.0

Method Summary
 void enable(boolean enable)
          Enables or Disables this service.
 String getActiveAcceleratorConfigurationId()
          Returns the id of the active accelerator configuration.
 String getActiveAcceleratorScopeId()
          Returns the id of the active accelerator scope.
 boolean processKey(KeyEvent event)
          To be called by an editor upon receiving a key event from its SWT text widget.
 void registerAction(IAction action)
          Registers an action with the key binding service.
 void setActiveAcceleratorScopeId(String scopeId)
          Sets the active accelerator scope id.
 

Method Detail

getActiveAcceleratorConfigurationId

public String getActiveAcceleratorConfigurationId()
Returns the id of the active accelerator configuration.

Returns:
the id of the active accelerator configuration

getActiveAcceleratorScopeId

public String getActiveAcceleratorScopeId()
Returns the id of the active accelerator scope.

Returns:
the id of the active accelerator scope

processKey

public boolean processKey(KeyEvent event)
To be called by an editor upon receiving a key event from its SWT text widget. The key binding service invokes the corresponding action if the key is mapped to an action. The key binding service may also invoke a mode, if the key is the first key in a (multi-key) accelerator key sequence of a registered action. If either of these cases occurs, processKey() returns true. If neither of these cases occurs, nothing happens and processKey() returns false.

Parameters:
event - The key to be processed
Returns:
true if the key was consumed by the key binding service, false if the editor is free to consume the key

registerAction

public void registerAction(IAction action)
Registers an action with the key binding service. Thereafter, if the accelerator key sequence associated with the action is pressed, the action is executed.

Parameters:
action - the action to be registered with the key binding service

setActiveAcceleratorScopeId

public void setActiveAcceleratorScopeId(String scopeId)
Sets the active accelerator scope id.

Parameters:
scopeId - the new accelerator scope id

enable

public void enable(boolean enable)
Enables or Disables this service. The default is false. Registered accelerators have no efect until the service is enabled;


Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.