E4 Command Parameter Object Type [message #1064971] |
Sat, 22 June 2013 04:57  |
Eclipse User |
|
|
|
Is the argument of a command only support String? I have found some post on making commands with parameters but all of them are only using String as parameter. Is it possible to have an argument of any object type? If yes, how?
And when creating a command parameter, what is the TypeID field for?
Thanks.
|
|
|
Re: E4 Command Parameter Object Type [message #1065148 is a reply to message #1064971] |
Mon, 24 June 2013 09:54  |
Eclipse User |
|
|
|
On 06/22/2013 04:57 AM, Markuz Surfing wrote:
> Is the argument of a command only support String? I have found some post
> on making commands with parameters but all of them are only using String
> as parameter. Is it possible to have an argument of any object type? If
> yes, how?
If you provide a converter, they you can have ParameterizedCommands that
have parameters of different types. The underlying restriction is the
parameters must be able to be converted from Object -> String -> Object.
The types are defined in the org.eclipse.ui.commands extension point,
and although they can be specified in Eclipse4 RCP apps, they can't be
defined yet from the model. See
org.eclipse.ui.internal.commands.CommandPersistence.readParameterTypesFromRegistry(IConfigurationElement[],
int, CommandManager) for an example of where they're defined while
running the 4.x Workbench. For how they're currently defined, see
org.eclipse.ui.commands [1]. It should be possible to define your own
commandParameterType programmatically once the CommandManager is available.
[1]
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fextension-points%2Forg_eclipse_ui_commands.html&cp=2_1_1_134
Later,
PW
--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench.htm
|
|
|
Powered by
FUDForum. Page generated in 0.03656 seconds