1 11 package org.eclipse.jdt.internal.launching; 12 13 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.core.runtime.IConfigurationElement; 16 import org.eclipse.debug.core.ILaunchConfiguration; 17 import org.eclipse.jdt.core.IClasspathEntry; 18 import org.eclipse.jdt.core.IJavaProject; 19 import org.eclipse.jdt.launching.IRuntimeClasspathEntry; 20 import org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver; 21 import org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver2; 22 import org.eclipse.jdt.launching.IVMInstall; 23 24 27 public class RuntimeClasspathEntryResolver implements IRuntimeClasspathEntryResolver2 { 28 29 private IConfigurationElement fConfigurationElement; 30 31 private IRuntimeClasspathEntryResolver fDelegate; 32 33 36 public RuntimeClasspathEntryResolver(IConfigurationElement element) { 37 fConfigurationElement = element; 38 } 39 40 43 public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, ILaunchConfiguration configuration) throws CoreException { 44 return getResolver().resolveRuntimeClasspathEntry(entry, configuration); 45 } 46 47 50 protected IRuntimeClasspathEntryResolver getResolver() throws CoreException { 51 if (fDelegate == null) { 52 fDelegate = (IRuntimeClasspathEntryResolver)fConfigurationElement.createExecutableExtension("class"); } 54 return fDelegate; 55 } 56 57 60 public String getVariableName() { 61 return fConfigurationElement.getAttribute("variable"); } 63 64 67 public String getContainerId() { 68 return fConfigurationElement.getAttribute("container"); } 70 71 75 public String getRuntimeClasspathEntryId() { 76 return fConfigurationElement.getAttribute("runtimeClasspathEntryId"); } 78 79 82 public IVMInstall resolveVMInstall(IClasspathEntry entry) throws CoreException { 83 return getResolver().resolveVMInstall(entry); 84 } 85 86 89 public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, IJavaProject project) throws CoreException { 90 return getResolver().resolveRuntimeClasspathEntry(entry, project); 91 } 92 93 96 public boolean isVMInstallReference(IClasspathEntry entry) { 97 try { 98 IRuntimeClasspathEntryResolver resolver = getResolver(); 99 if (resolver instanceof IRuntimeClasspathEntryResolver2) { 100 IRuntimeClasspathEntryResolver2 resolver2 = (IRuntimeClasspathEntryResolver2) resolver; 101 return resolver2.isVMInstallReference(entry); 102 } else { 103 return resolver.resolveVMInstall(entry) != null; 104 } 105 } catch (CoreException e) { 106 return false; 107 } 108 } 109 110 } 111 | Popular Tags |