if (!cmd.isDefined())
return false;
IHandlerService handlerService = CommonUtils.getService(PlatformUI
.getWorkbench(), IHandlerService.class);
EvaluationContext c = null;
if (selection != null) {
c = new EvaluationContext(
handlerService.createContextSnapshot(false),
selection.toList());
c.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
c.removeVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
}
try {
if (c != null)
handlerService.executeCommandInContext(
new ParameterizedCommand(cmd, null), null, c);