Search in sources :

Example 1 with ProjectSourceContainer

use of org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer in project erlide_eclipse by erlang.

the class ErlangSourcePathComputerDelegate method computeSourceContainers.

@Override
public ISourceContainer[] computeSourceContainers(final ILaunchConfiguration configuration, final IProgressMonitor monitor) throws CoreException {
    final List<ISourceContainer> containers = new ArrayList<>();
    final IProject[] projects = LaunchUtils.getErlangLaunchConfigurationProjects(configuration);
    for (final IProject p : projects) {
        containers.add(new ProjectSourceContainer(p, false));
    }
    if (containers.isEmpty()) {
        containers.add(new WorkspaceSourceContainer());
    }
    final String runtimeName = configuration.getAttribute(ErlRuntimeAttributes.RUNTIME_NAME, "").trim();
    final RuntimeInfo info = BackendCore.getRuntimeInfoCatalog().getRuntime(runtimeName);
    containers.add(new ErlangOtpSourceContainer(new Path(info.getOtpHome())));
    return containers.toArray(new ISourceContainer[containers.size()]);
}
Also used : Path(org.eclipse.core.runtime.Path) WorkspaceSourceContainer(org.eclipse.debug.core.sourcelookup.containers.WorkspaceSourceContainer) RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) ErlangOtpSourceContainer(org.erlide.backend.debug.model.ErlangOtpSourceContainer) ArrayList(java.util.ArrayList) ISourceContainer(org.eclipse.debug.core.sourcelookup.ISourceContainer) ProjectSourceContainer(org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer) IProject(org.eclipse.core.resources.IProject)

Example 2 with ProjectSourceContainer

use of org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer in project webtools.sourceediting by eclipse.

the class XSLTSourcePathComputerDelegate method computeSourceContainers.

public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
    List<ISourceContainer> containers = new ArrayList<ISourceContainer>();
    String sourceFileExpr = configuration.getAttribute(XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, (String) null);
    IPath sourceFile = getSubstitutedPath(sourceFileExpr);
    LaunchPipeline pipeline = hydratePipeline(configuration);
    // TODO have some way of knowing whether it is an IResource or not
    containers.add(new DirectorySourceContainer(sourceFile, false));
    for (Iterator<?> iter = pipeline.getTransformDefs().iterator(); iter.hasNext(); ) {
        LaunchTransform transform = (LaunchTransform) iter.next();
        IPath path = transform.getPath();
        ISourceContainer sourceContainer = null;
        if (transform.getPathType().equals(LaunchTransform.RESOURCE_TYPE)) {
            IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
            IContainer container = resource.getParent();
            if (container.getType() == IResource.PROJECT) {
                sourceContainer = new ProjectSourceContainer((IProject) container, false);
            } else if (container.getType() == IResource.FOLDER) {
                sourceContainer = new FolderSourceContainer(container, false);
            }
        } else {
            sourceContainer = new DirectorySourceContainer(path, false);
        }
        containers.add(sourceContainer);
    }
    return containers.toArray(new ISourceContainer[0]);
}
Also used : LaunchTransform(org.eclipse.wst.xsl.launching.config.LaunchTransform) IPath(org.eclipse.core.runtime.IPath) LaunchPipeline(org.eclipse.wst.xsl.launching.config.LaunchPipeline) FolderSourceContainer(org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer) ArrayList(java.util.ArrayList) DirectorySourceContainer(org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer) ProjectSourceContainer(org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer) IProject(org.eclipse.core.resources.IProject) ISourceContainer(org.eclipse.debug.core.sourcelookup.ISourceContainer) IContainer(org.eclipse.core.resources.IContainer) IResource(org.eclipse.core.resources.IResource)

Aggregations

ArrayList (java.util.ArrayList)2 IProject (org.eclipse.core.resources.IProject)2 ISourceContainer (org.eclipse.debug.core.sourcelookup.ISourceContainer)2 ProjectSourceContainer (org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer)2 IContainer (org.eclipse.core.resources.IContainer)1 IResource (org.eclipse.core.resources.IResource)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 DirectorySourceContainer (org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer)1 FolderSourceContainer (org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer)1 WorkspaceSourceContainer (org.eclipse.debug.core.sourcelookup.containers.WorkspaceSourceContainer)1 LaunchPipeline (org.eclipse.wst.xsl.launching.config.LaunchPipeline)1 LaunchTransform (org.eclipse.wst.xsl.launching.config.LaunchTransform)1 ErlangOtpSourceContainer (org.erlide.backend.debug.model.ErlangOtpSourceContainer)1 RuntimeInfo (org.erlide.runtime.runtimeinfo.RuntimeInfo)1