[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.rcp] Using object as Command's Parameter
|
I realized the way to use java object as Command's parameter by Paul
Webster's help. (thanks!)
But it needs a lot of work and I hate that.
is this right way?
ICommandService cService = ... getting command service ...
Command openCommand = cService.getCommand("commandID");
IParameter param = openCommand.getParameter("paramID");
ITypedParameter tParam = (ITypedParameter) param;
Parameterization parameterization =
new Parameterization(
param,
tParam.getParameterType()
.getValueConverter()
.convertToString(parameterValueObject)
);
ParameterizedCommand pCommand = new ParameterizedCommand(openCommand,
new Parameterization[] { parameterization });
IHandlerService hService = ... getting handler service ...
hService.executeCommand(pCommand, null);
===============================================================
I think this job can be automated like as follows:
Parameterization parameterization =
new Parameterization(
param, parameterValueObject
);
Since Eclipse workbench knows which parameter type converter is needed
by referring extension configuration, why do I have to convert it
manually. I think it's inappropriate.
Please teach me the best approach if there is.