Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » E4 Command Parameter Object Type
E4 Command Parameter Object Type [message #1064971] Sat, 22 June 2013 08:57 Go to next message
Markuz Surfing is currently offline Markuz SurfingFriend
Messages: 7
Registered: June 2013
Junior Member
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 13:54 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Previous Topic:org.eclipse.ui.forms
Next Topic:Using e3 properties view in e4 RCP application
Goto Forum:
  


Current Time: Thu Apr 25 10:21:41 GMT 2024

Powered by FUDForum. Page generated in 0.02491 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top