|
Eclipse Platform Release 3.2 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.commands.common.EventManager
org.eclipse.core.commands.common.HandleObjectManager
org.eclipse.core.commands.CommandManager
A central repository for commands -- both in the defined and undefined states. Commands can be created and retrieved using this manager. It is possible to listen to changes in the collection of commands by attaching a listener to the manager.
getCommand(String)
Field Summary | |
---|---|
static String |
AUTOGENERATED_CATEGORY_ID
The identifier of the category in which all auto-generated commands will appear. |
Fields inherited from class org.eclipse.core.commands.common.HandleObjectManager |
---|
definedHandleObjects, handleObjectsById |
Constructor Summary | |
---|---|
CommandManager()
|
Method Summary | |
---|---|
void |
addCommandManagerListener(ICommandManagerListener listener)
Adds a listener to this command manager. |
void |
addExecutionListener(IExecutionListener listener)
Adds an execution listener to this manager. |
void |
categoryChanged(CategoryEvent categoryEvent)
Notifies that one or more properties of an instance of Category have changed. |
void |
commandChanged(CommandEvent commandEvent)
Notifies that one or more properties of an instance of Command have changed. |
void |
defineUncategorizedCategory(String name,
String description)
Sets the name and description of the category for uncategorized commands. |
ParameterizedCommand |
deserialize(String serializedParameterizedCommand)
Returns a ParameterizedCommand with a command and
parameterizations as specified in the provided
serializedParameterizedCommand string. |
Command[] |
getAllCommands()
Returns all of the commands known by this manager -- defined and undefined. |
Category |
getCategory(String categoryId)
Gets the category with the given identifier. |
Command |
getCommand(String commandId)
Gets the command with the given identifier. |
Category[] |
getDefinedCategories()
Returns the categories that are defined. |
Set |
getDefinedCategoryIds()
Returns the set of identifiers for those category that are defined. |
Set |
getDefinedCommandIds()
Returns the set of identifiers for those commands that are defined. |
Command[] |
getDefinedCommands()
Returns the commands that are defined. |
Set |
getDefinedParameterTypeIds()
Returns the set of identifiers for those parameter types that are defined. |
ParameterType[] |
getDefinedParameterTypes()
Returns the command parameter types that are defined. |
String |
getHelpContextId(Command command)
Gets the help context identifier for a particular command. |
ParameterType |
getParameterType(String parameterTypeId)
Gets the command ParameterType with the given identifier. |
void |
parameterTypeChanged(ParameterTypeEvent parameterTypeEvent)
Notifies that one or more properties of an instance of ParameterType have changed. Specific details are described in the
ParameterTypeEvent . |
void |
removeCommandManagerListener(ICommandManagerListener listener)
Removes a listener from this command manager. |
void |
removeExecutionListener(IExecutionListener listener)
Removes an execution listener from this command manager. |
void |
setHandlersByCommandId(Map handlersByCommandId)
Block updates all of the handlers for all of the commands. |
void |
setHelpContextId(IHandler handler,
String helpContextId)
Sets the help context identifier to associate with a particular handler. |
Methods inherited from class org.eclipse.core.commands.common.HandleObjectManager |
---|
checkId, getDefinedHandleObjectIds |
Methods inherited from class org.eclipse.core.commands.common.EventManager |
---|
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String AUTOGENERATED_CATEGORY_ID
null
.
Constructor Detail |
public CommandManager()
Method Detail |
public final void addCommandManagerListener(ICommandManagerListener listener)
listener
- The listener to attach; must not be null
.public final void addExecutionListener(IExecutionListener listener)
listener
- The listener to attach; must not be null
.public final void categoryChanged(CategoryEvent categoryEvent)
ICategoryListener
Category
have changed. Specific details are described in
the CategoryEvent
.
categoryChanged
in interface ICategoryListener
categoryEvent
- the category event. Guaranteed not to be null
.public final void commandChanged(CommandEvent commandEvent)
ICommandListener
Command
have changed. Specific details are described in
the CommandEvent
.
commandChanged
in interface ICommandListener
commandEvent
- the command event. Guaranteed not to be null
.public final void defineUncategorizedCategory(String name, String description)
getCategory(String)
is called with null
.
name
- The name of the category for uncategorized commands; must not
be null
.description
- The description of the category for uncategorized commands;
may be null
.public final ParameterizedCommand deserialize(String serializedParameterizedCommand) throws NotDefinedException, SerializationException
Returns a ParameterizedCommand
with a command and
parameterizations as specified in the provided
serializedParameterizedCommand
string. The
serializedParameterizedCommand
must use the format
returned by ParameterizedCommand.serialize()
and described in the
Javadoc for that method.
If a parameter id encoded in the
serializedParameterizedCommand
does not exist in the
encoded command, that parameter id and value are ignored. A given
parameter id should not be used more than once in
serializedParameterizedCommand
. This will not result in
an exception, but in this case the value of the parameter when the
command is executed is unspecified.
This method will never return null
, however it may throw
an exception if there is a problem processing the serialization string or
the encoded command is undefined.
serializedParameterizedCommand
- a string representing a command id and parameter ids and
values; must not be null
ParameterizedCommand
with the command and
parameterizations encoded in the
serializedParameterizedCommand
; never
null
.
NotDefinedException
- if the command indicated in
serializedParameterizedCommand
is not defined
SerializationException
- if there is an error deserializing
serializedParameterizedCommand
ParameterizedCommand.serialize()
public final Command[] getAllCommands()
null
.public final Category getCategory(String categoryId)
categoryId
- The identifier to find; must not be null
. If
the category is null
, then a category suitable
for uncategorized items is defined and returned.
null
, but it might be undefined.Category
public final Command getCommand(String commandId)
commandId
- The identifier to find; must not be null
and
must not be zero-length.
null
, but it might be undefined.Command
public final Category[] getDefinedCategories()
null
.public final Set getDefinedCategoryIds()
null
.public final Set getDefinedCommandIds()
null
.public final Command[] getDefinedCommands()
null
.public final Set getDefinedParameterTypeIds()
null
.public final ParameterType[] getDefinedParameterTypes()
null
.public final String getHelpContextId(Command command) throws NotDefinedException
null
is returned.
command
- The command for which the help context should be retrieved;
must not be null
.
null
.
NotDefinedException
- If the given command is not defined.public final ParameterType getParameterType(String parameterTypeId)
ParameterType
with the given identifier. If no
such command parameter type currently exists, then the command parameter
type will be created (but will be undefined).
parameterTypeId
- The identifier to find; must not be null
and
must not be zero-length.
ParameterType
with the given identifier; this value
will never be null
, but it might be undefined.public final void parameterTypeChanged(ParameterTypeEvent parameterTypeEvent)
ParameterType
have changed. Specific details are described in the
ParameterTypeEvent
.
parameterTypeChanged
in interface IParameterTypeListener
parameterTypeEvent
- the event. Guaranteed not to be null
.public final void removeCommandManagerListener(ICommandManagerListener listener)
listener
- The listener to be removed; must not be null
.public final void removeExecutionListener(IExecutionListener listener)
listener
- The listener to be removed; must not be null
.public final void setHandlersByCommandId(Map handlersByCommandId)
null
or the command id does not exist in the map, then
the command becomes unhandled. Otherwise, the handler is set to the
corresponding value in the map.
handlersByCommandId
- A map of command identifiers (String
) to
handlers (IHandler
). This map may be
null
if all handlers should be cleared.
Similarly, if the map is empty, then all commands will become
unhandled.public final void setHelpContextId(IHandler handler, String helpContextId)
handler
- The handler with which to register a help context identifier;
must not be null
.helpContextId
- The help context identifier to register; may be
null
if the help context identifier should be
removed.
|
Eclipse Platform Release 3.2 |
|||||||||||
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, 2006. All rights reserved.