Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Command parameter as Object and not as String
Command parameter as Object and not as String [message #1067924] Thu, 11 July 2013 09:19
Jan Reimann is currently offline Jan Reimann
Messages: 127
Registered: July 2009
Senior Member
Hello,
I create some commands programmatically.They should have parameters
which should get Objects as their values. Currently, to assign the value
for a parameter, a Parameterization is needed, which only allows to get
a String value. Why is that and can I achieve to pass an Object?
For my created commands I implement IParameter. What I don't really
understand for what the getValues() method is good for. Can somebody
explain it?
What I do is the following:

IParameter param = createParam();
ICommandService commandService = (ICommandService)
serviceLocator.getService(ICommandService.class);
Command command = commandService.getCommand(commandID);
command.define(name, explanation, category, new IParameter[]{param});

Then the command is contributed to a context menu which should execute
some calculation depending on the current selection of the editor in
which the command was invoked. Therefore, I don't want to contribute the
above command but wrapped into a ParameterizedCommand like this:

Parameterization parameterization = new Parameterization(param, value);
ParameterizedCommand parameterCommand = new
ParameterizedCommand(command, new Parameterization[]{param});

The contribution is not the problem, the problem is the second parameter
of the Parameterization constructor: value. How can I achive to pass an
Object there and not a String? I don't want to serialize and deserialize
an object because it is too much overhead and in my opinion not needed
at all because it's not a webservice (or something similar) where this
is needed.

Any help?

best regards,
Jan
Previous Topic:Contribution on Debug Configurations window
Next Topic:Eclipse 4.3: Use of the "org.eclipse.ui.editorActions" extension
Goto Forum:
  


Current Time: Fri Oct 31 10:53:13 GMT 2014

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

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