在 Handler 中从 eclipse rcp/e4 中检索参数
Retrieving parameters from eclipse rcp/e4 in Handler
我有执行我的 handler/command 的代码,它到达这里:
@Execute
public Object execute(Shell shell) {
System.out.println("Executing login!");
return null;
}
但是,我找不到注入服务来为我提供我在命令中传递的参数。
我试过:
@Execute
public Object execute(ExecutionEvent event)
但它甚至没有看到这个方法,我怀疑这是因为它甚至不是 e4。* class。我知道 Eclipse RCP 4 - Handler method parameters 但它没有告诉我命令参数是哪个服务,例如:
ParameterizedCommand myCommand = commandService.createCommand("mycommand.login", credentials);
Object result = handlerService.executeHandler(myCommand);
凭据映射中我的值在哪里?
您可以使用以下方法将整个 ParameterizedCommand
注入处理程序:
@Execute
public void execute(ParameterizedCommand command)
或者您可以使用它们的 ID 获取各个参数:
@Execute
public void execute(@Named("parameter id") String parameter)
我有执行我的 handler/command 的代码,它到达这里:
@Execute
public Object execute(Shell shell) {
System.out.println("Executing login!");
return null;
}
但是,我找不到注入服务来为我提供我在命令中传递的参数。
我试过:
@Execute
public Object execute(ExecutionEvent event)
但它甚至没有看到这个方法,我怀疑这是因为它甚至不是 e4。* class。我知道 Eclipse RCP 4 - Handler method parameters 但它没有告诉我命令参数是哪个服务,例如:
ParameterizedCommand myCommand = commandService.createCommand("mycommand.login", credentials);
Object result = handlerService.executeHandler(myCommand);
凭据映射中我的值在哪里?
您可以使用以下方法将整个 ParameterizedCommand
注入处理程序:
@Execute
public void execute(ParameterizedCommand command)
或者您可以使用它们的 ID 获取各个参数:
@Execute
public void execute(@Named("parameter id") String parameter)