private boolean isAnyProjectInSourceContainers( ISourceContainer[] containers, Set<IProject> projects) { for (ISourceContainer container : containers) { if (container instanceof ProjectSourceContainer) { ProjectSourceContainer projectContainer = (ProjectSourceContainer) container; if (projects.contains(projectContainer.getProject())) return true; } try { boolean found = isAnyProjectInSourceContainers( container.getSourceContainers(), projects); if (found) return true; } catch (CoreException e) { // Ignore the child source containers, continue search } } return false; }
@Override public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { String projectName = configuration.getAttribute(BfLaunchConfigurationDelegate.PROJECT_ATTR, ""); IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); if (project != null) { return new ISourceContainer[]{new ProjectSourceContainer(project, false)}; } else { return new ISourceContainer[]{new WorkspaceSourceContainer()}; } }