KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > launching > sourcelookup > containers > JavaSourcePathComputer


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.launching.sourcelookup.containers;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IProgressMonitor;
15 import org.eclipse.debug.core.ILaunchConfiguration;
16 import org.eclipse.debug.core.sourcelookup.ISourceContainer;
17 import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate;
18 import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
19 import org.eclipse.jdt.launching.JavaRuntime;
20
21 /**
22  * Computes a default source lookup path for Java applications.
23  * The source path provider associated with a launch configuration is consulted
24  * to compute a source lookup path. The source path provider is determined
25  * by the <code>ATTR_SOURCE_PATH_PROVIDER</code> launch configuration attribute,
26  * which defaults to the <code>StandardSourcePathProvider</code> when unspecified.
27  * The source path provider computes a collection of <code>IRuntimeClasspathEntry</code>'s
28  * which are translated to source containers (<code>ISourceContainer</code>).
29  * <p>
30  * Clients may subclass this class.
31  * </p>
32  * @since 3.0
33  *
34  */

35 public class JavaSourcePathComputer implements ISourcePathComputerDelegate {
36     
37     /**
38      * Unique identifier for the local Java source path computer
39      * (value <code>org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer</code>).
40      */

41     public static final String JavaDoc ID = "org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer"; //$NON-NLS-1$
42

43     /* (non-Javadoc)
44      * @see org.eclipse.debug.core.sourcelookup.ISourcePathComputer#getId()
45      *
46      * No longer used.
47      */

48     public String JavaDoc getId() {
49         return ID;
50     }
51     
52     /* (non-Javadoc)
53      * @see org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate#computeSourceContainers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.runtime.IProgressMonitor)
54      */

55     public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
56         IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedSourceLookupPath(configuration);
57         IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath(entries, configuration);
58         return JavaRuntime.getSourceContainers(resolved);
59     }
60     
61 }
62
Popular Tags