@SuppressWarnings("restriction")
private void createTargetPlatform(final IProgressMonitor monitor) throws CoreException {
final ITargetPlatformService targetPlatformService = (ITargetPlatformService) KarafUIPluginActivator.getDefault().getService(ITargetPlatformService.class.getName());
final IFile targetLocation = createTargetDefinitionFile();
final ITargetHandle targetHandle = targetPlatformService.getTarget(targetLocation);
final ITargetDefinition target = targetHandle.getTargetDefinition();
target.setName(getKarafProject().getName());
final List<IBundleContainer> bundleContainers = KarafLaunchUtils.getBundleContainers(getKarafPlatformModel());
target.setBundleContainers(bundleContainers.toArray(new IBundleContainer[0]));