// remove old icons
logger.debug("removing old toolbar icons");
countsToolbarManager.removeAll();
ActionContributionItem item;
// participants count
ParticipantCountAction participantCountAction = (ParticipantCountAction)appContext.getBean(
"participantCountAction", new Object[] {
"org.criticalfailure.torchlight.ui.menu.campaign.participants",
PlatformUI.getWorkbench().getActiveWorkbenchWindow(), campaign });
item = new ActionContributionItem(participantCountAction);
item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
countsToolbarManager.add(item);
// fill in the bar with count actions provided by other plugins
try {
for(Object service : ServiceUtils.getServiceForCampaignType(bundleContext,
ICampaignCountActionProvider.class.getName(), campaign.getTypeId())) {
logger.trace("service: " + service);
for(IAction action : ((ICampaignCountActionProvider)service).getActions(campaign)) {
logger.trace("action: " + action);
item = new ActionContributionItem(action);
item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
countsToolbarManager.add(item);
}
}
}
catch(InvalidSyntaxException e) {
logger.error("Exception while adding campaign count actions: " + e.getLocalizedMessage(), e);
// TODO: alert service
}
// templates count
TemplateCountAction templateCountAction = (TemplateCountAction)appContext.getBean("templateCountAction",
new Object[] { "org.criticalfailure.torchlight.ui.menu.campaign.templates",
PlatformUI.getWorkbench().getActiveWorkbenchWindow(), campaign });
item = new ActionContributionItem(templateCountAction);
item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
countsToolbarManager.add(item);
// instances count?
InstanceCountAction instanceCountAction = (InstanceCountAction)appContext.getBean("instanceCountAction",
new Object[] { "org.criticalfailure.torchlight.ui.menu.campaign.instances",
PlatformUI.getWorkbench().getActiveWorkbenchWindow(), campaign });
item = new ActionContributionItem(instanceCountAction);
item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
countsToolbarManager.add(item);
// // retrieve list of object types (standard)
// logger.debug("adding standard object types");
// Set<String> stdTypes = objectTypeService.getStandardObjectTypes();