Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.ui.commands
Interface ICommandManager

public interface ICommandManager

An instance of `ICommandManager` can be used to obtain instances of `ICommand`, as well as manage whether or not those instances are active or inactive, enabled or disabled.

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

Since:
  3.0
See Also:
  `ICommand`, `ICommandManagerListener`

Method Summary
`void` | `addCommandManagerListener(ICommandManagerListener commandManagerListener)` Registers an instance of `ICommandManagerListener` to listen for changes to attributes of this instance.
`Set` | `getActiveContextIds()` Returns the set of identifiers to active contexts.
`String` | `getActiveKeyConfigurationId()` Returns the active key configuration.
`String` | `getActiveLocale()` Returns the active locale.
`String` | `getActivePlatform()` Returns the active platform.
`ICategory` | `getCategory(String categoryId)` Returns a handle to a category given an identifier.
`ICommand` | `getCommand(String commandId)` Returns a handle to a command given an identifier.
`Set` | `getDefinedCategoryIds()` Returns the set of identifiers to defined categories.
`Set` | `getDefinedCommandIds()` Returns the set of identifiers to defined commands.
`Set` | `getDefinedKeyConfigurationIds()` Returns the set of identifiers to defined key configurations.
`IKeyConfiguration` | `getKeyConfiguration(String keyConfigurationId)` Returns a handle to a key configuration given an identifier.
`Map` | `getPartialMatches(KeySequence keySequence)` Finds all of the commands which have key bindings that start with the given key sequence.
`String` | `getPerfectMatch(KeySequence keySequence)` Finds the command which has the given key sequence as one of its key bindings.
`boolean` | `isPartialMatch(KeySequence keySequence)` Checks to see whether there are any commands which have key bindings that start with the given key sequence.
`boolean` | `isPerfectMatch(KeySequence keySequence)` Checks to see if there is a command with the given key sequence as one of its key bindings.
`void` | `removeCommandManagerListener(ICommandManagerListener commandManagerListener)` Unregisters an instance of `ICommandManagerListener` listening for changes to attributes of this instance.

Method Detail

### addCommandManagerListener

    public void addCommandManagerListener(ICommandManagerListener commandManagerListener)

  Registers an instance of `ICommandManagerListener` to listen for changes to attributes of this instance.

  Parameters:
    `commandManagerListener` - the instance of `ICommandManagerListener` to register. Must not be `null`. If an attempt is made to register an instance of `ICommandManagerListener` which is already registered with this instance, no operation is performed.

### getActiveContextIds

    public Set getActiveContextIds()

  Returns the set of identifiers to active contexts.

  Notification is sent to all registered listeners if this property changes.

  Returns:
    the set of identifiers to active contexts. This set may be empty, but is guaranteed not to be `null`. If this set is not empty, it is guaranteed to only contain instances of `String`.

### getActiveKeyConfigurationId

    public String getActiveKeyConfigurationId()

  Returns the active key configuration.

  Notification is sent to all registered listeners if this property changes.

  Returns:
    the active key configuration identifier. This set may be empty, but it is guaranteed to not be `null`. If this set is not empty, it is guaranteed to only contains instances of `String`.

### getActiveLocale

    public String getActiveLocale()

  Returns the active locale. While this property tends to be simply the result of `Locale.getDefault()`, it may also be changed at runtime by different implementations of command manager.

  Notification is sent to all registered listeners if this property changes.

  Returns:
    the active locale. May be `null`.

### getActivePlatform

    public String getActivePlatform()

  Returns the active platform. While this property tends to be simply the result of `SWT.getPlatform()`, it may also be changed at runtime by different implementations of command manager.

  Notification is sent to all registered listeners if this property changes.

  Returns:
    the active platform. May be `null`.

### getCategory

    public ICategory getCategory(String categoryId)

  Returns a handle to a category given an identifier.

  Parameters:
    `categoryId` - an identifier. Must not be `null`
  Returns:
    a handle to a category.

### getCommand

    public ICommand getCommand(String commandId)

  Returns a handle to a command given an identifier.

  Parameters:
    `commandId` - an identifier. Must not be `null`
  Returns:
    a handle to a command.

### getDefinedCategoryIds

    public Set getDefinedCategoryIds()

  Returns the set of identifiers to defined categories.

  Notification is sent to all registered listeners if this attribute changes.

  Returns:
    the set of identifiers to defined categories. This set may be empty, but is guaranteed not to be `null`. If this set is not empty, it is guaranteed to only contain instances of `String`.

### getDefinedCommandIds

    public Set getDefinedCommandIds()

  Returns the set of identifiers to defined commands.

  Notification is sent to all registered listeners if this attribute changes.

  Returns:
    the set of identifiers to defined commands. This set may be empty, but is guaranteed not to be `null`. If this set is not empty, it is guaranteed to only contain instances of `String`.

### getDefinedKeyConfigurationIds

    public Set getDefinedKeyConfigurationIds()

  Returns the set of identifiers to defined key configurations.

  Notification is sent to all registered listeners if this attribute changes.

  Returns:
    the set of identifiers to defined key configurations. This set may be empty, but is guaranteed not to be `null`. If this set is not empty, it is guaranteed to only contain instances of `String`.

### getKeyConfiguration

    public IKeyConfiguration getKeyConfiguration(String keyConfigurationId)

  Returns a handle to a key configuration given an identifier.

  Parameters:
    `keyConfigurationId` - an identifier. Must not be `null`
  Returns:
    a handle to a key configuration.

### getPartialMatches

    public Map getPartialMatches(KeySequence keySequence)

  Finds all of the commands which have key bindings that start with the given key sequence.

  Parameters:
    `keySequence` - The prefix to look for; must not be `null`.
  Returns:
    A map of all of the matching key sequences ( `KeySequence`) to command identifiers ( `String`). This map may be empty, but it is never `null`.

### getPerfectMatch

    public String getPerfectMatch(KeySequence keySequence)

  Finds the command which has the given key sequence as one of its key bindings.

  Parameters:
    `keySequence` - The key binding to look for; must not be `null`.
  Returns:
    The command id for the matching command, if any; `null` if none.

### isPartialMatch

    public boolean isPartialMatch(KeySequence keySequence)

  Checks to see whether there are any commands which have key bindings that start with the given key sequence.

  Parameters:
    `keySequence` - The prefix to look for; must not be `null`.
  Returns:
    `true` if at least one command has a key binding that starts with `keySequence`;`false` otherwise.

### isPerfectMatch

    public boolean isPerfectMatch(KeySequence keySequence)

  Checks to see if there is a command with the given key sequence as one of its key bindings.

  Parameters:
    `keySequence` - The key binding to look for; must not be `null`.
  Returns:
    `true` if a command has a matching key binding; `false` otherwise.

### removeCommandManagerListener

    public void removeCommandManagerListener(ICommandManagerListener commandManagerListener)

  Unregisters an instance of `ICommandManagerListener` listening for changes to attributes of this instance.

  Parameters:
    `commandManagerListener` - the instance of `ICommandManagerListener` to unregister. Must not be `null`. If an attempt is made to unregister an instance of `ICommandManagerListener` which is not already registered with this instance, no operation is performed.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.