if (addEntry(entry)) {
String commandId = ROSTERCOMMAND_PREFIX + getNextCommandIdIndex();
// Get existing/new command
Command command = commandService.getCommand(commandId);
command.define(commandId, null, commandService.getCategory(commandId + ".c")); //$NON-NLS-1$
IHandler handler = command.getHandler();
// Only mess with it if it was of old type
if (handler != null && handler instanceof AbstractRosterMenuHandler) {
AbstractRosterMenuHandler drh = (AbstractRosterMenuHandler) handler;
if (drh != null) {
drh.fireHandlerChangeEvent();
drh.dispose();
}
}
IHandler newHandler = createRosterEntryHandler(entry);
command.setHandler(newHandler);
handlerActivations.add(handlerService.activateHandler(commandId, newHandler));
return new IContributionItem[] {createCommandContributionItemForEntry(commandId, entry)};
}
return NO_CONTRIBUTIONS;