ISelectionService service = (ISelectionService) locator.getService(ISelectionService.class);
ISelection selection = service.getSelection();
if (selection instanceof StructuredSelection) {
Object element = ((StructuredSelection) selection).getFirstElement();
if (element instanceof IBeansConfig) {
IBeansConfig config = (IBeansConfig) element;
IBeansProject beansProject = BeansModelUtils.getProject(config);
Set<IBeansConfigSet> configSets = beansProject.getConfigSets();
for (IBeansConfigSet configSet : configSets) {
if (!configSet.hasConfig(config.getElementName())) {
IContributionItem contribution = new ActionContributionItem(
new AddToConfigSetDynamicAction(configSet, config));
items.add(contribution);
}
}