package xvrengine.launching;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate;
import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.WorkspaceSourceContainer;
import org.xvr.xvrengine.util.XVRConstants;
public class XVRSourcePathComputerDelegate implements ISourcePathComputerDelegate {
@Override
public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
//IProject project = XVRUtils.getActiveProject();
String name = configuration.getAttribute(XVRConstants.XVR_LAUNCH_CONFIG_PROJECT_NAME_KEY, (String)null);
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
ISourceContainer sourceContainer = null;
if(project.exists()){
sourceContainer = new ProjectSourceContainer(project, false);
}else{
sourceContainer = new WorkspaceSourceContainer();
}
return new ISourceContainer[]{sourceContainer};
}
}