Object object = getContributionObject(context, contribution);
if( object == null ) {
return;
}
IEclipseContext runContext = context.createChild("DI-ToolItem");
try {
ContributionsAnalyzer.populateModelInterfaces(item, runContext, item.getClass().getInterfaces());
runContext.set(MItem.class.getName(), item);
ContextInjectionFactory.invoke(object,Execute.class, context.getActiveLeaf(), runContext);
} finally {
runContext.dispose();
}
} else if( item instanceof MHandledItem ) {
MHandledItem handledItem = (MHandledItem) item;
EHandlerService service = (EHandlerService) context.get(EHandlerService.class.getName());
ParameterizedCommand cmd = handledItem.getWbCommand();
if (cmd == null) {
cmd = generateParameterizedCommand(handledItem, context);
handledItem.setWbCommand(cmd);
}
if (cmd == null) {
logger.error("Failed to execute: " + handledItem.getCommand());
return;
}
final IEclipseContext runContext = context.createChild("HI-ToolItem");
try {
ContributionsAnalyzer.populateModelInterfaces(item,runContext, item.getClass().getInterfaces());
service.executeHandler(cmd, runContext);
} finally {
runContext.dispose();
}
}
}