1 11 12 package org.eclipse.ant.internal.ui.launchConfigurations; 13 14 import java.util.ArrayList ; 15 import java.util.List ; 16 17 import org.eclipse.core.runtime.CoreException; 18 import org.eclipse.debug.core.ILaunchConfiguration; 19 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; 20 import org.eclipse.jdt.launching.IRuntimeClasspathEntry; 21 import org.eclipse.jdt.launching.JavaRuntime; 22 import org.eclipse.jdt.launching.StandardClasspathProvider; 23 24 public class AntClasspathProvider extends StandardClasspathProvider { 25 26 29 public IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration configuration) throws CoreException { 30 boolean useDefault = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true); 31 if (useDefault) { 32 List rtes = new ArrayList (10); 33 IRuntimeClasspathEntry jreEntry = null; 34 try { 35 jreEntry = JavaRuntime.computeJREEntry(configuration); 36 } catch (CoreException e) { 37 } 39 if (jreEntry == null) { 40 jreEntry = JavaRuntime.newRuntimeContainerClasspathEntry( 41 JavaRuntime.newDefaultJREContainerPath(), IRuntimeClasspathEntry.STANDARD_CLASSES); 42 } 43 rtes.add(jreEntry); 44 rtes.add(new AntHomeClasspathEntry()); 45 rtes.add(new ContributedClasspathEntriesEntry()); 46 return (IRuntimeClasspathEntry[]) rtes.toArray(new IRuntimeClasspathEntry[rtes.size()]); 47 } 48 return super.computeUnresolvedClasspath(configuration); 49 } 50 } 51 | Popular Tags |