Search in sources :

Example 1 with DirectorySourceContainer

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

the class ErlangOtpSourceContainer method createSourceContainers.

@Override
protected ISourceContainer[] createSourceContainers() throws CoreException {
    final IPath lib = otpHome.addTrailingSeparator().append("lib").addTrailingSeparator();
    final Set<String> moduleNames = modules(lib.toFile());
    final List<IPath> moduleDirs = new ArrayList<>();
    for (final String moduleName : moduleNames) {
        final String h = highestVersion(lib.toFile(), moduleName);
        if (h != null) {
            moduleDirs.add(lib.addTrailingSeparator().append(h));
        }
    }
    final List<ISourceContainer> r = new ArrayList<>();
    for (final IPath dir : moduleDirs) {
        r.add(new DirectorySourceContainer(dir.addTrailingSeparator().append("src"), false));
    }
    return r.toArray(new ISourceContainer[r.size()]);
}
Also used : IPath(org.eclipse.core.runtime.IPath) ArrayList(java.util.ArrayList) DirectorySourceContainer(org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer) ISourceContainer(org.eclipse.debug.core.sourcelookup.ISourceContainer)

Example 2 with DirectorySourceContainer

use of org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer 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 IPath (org.eclipse.core.runtime.IPath)2 ISourceContainer (org.eclipse.debug.core.sourcelookup.ISourceContainer)2 DirectorySourceContainer (org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer)2 IContainer (org.eclipse.core.resources.IContainer)1 IProject (org.eclipse.core.resources.IProject)1 IResource (org.eclipse.core.resources.IResource)1 FolderSourceContainer (org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer)1 ProjectSourceContainer (org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer)1 LaunchPipeline (org.eclipse.wst.xsl.launching.config.LaunchPipeline)1 LaunchTransform (org.eclipse.wst.xsl.launching.config.LaunchTransform)1