Eclipse Search

Loading

Oct 28, 2009

Associating a Command with a Job

Earlier we saw how to associate an Action with a Job. Now you can associate a Command. Its very similar - use the constant to set a property on the job:

ICommandService service = (ICommandService) serviceLocator.getService(ICommandService.class);
Command command = service.getCommand(commandId);
ParameterizedCommand parameterizedCommand = new ParameterizedCommand(command, null);
job.setProperty(IProgressConstants.COMMAND_PROPERTY, parameterizedCommand);

You have to specify either the ACTION_PROPERTY or COMMAND_PROPERTY, but not both. If you specify both, neither of them will get executed.

Note: You need a 3.6 M3 or a latest I-Build for this to work.

2 comments:

  1. Congrats! Nice to have this in now. Could be useful in the future and one more step away from (outdated) actions.
    ReplyDelete
  2. Wow,
    until now I did not realize, I missed this feature. Thank you!
    Great work!
    ReplyDelete