1 12 package org.eclipse.core.internal.variables; 13 14 import java.net.URL ; 15 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.core.runtime.Platform; 18 import org.eclipse.core.variables.IDynamicVariable; 19 import org.eclipse.core.variables.IDynamicVariableResolver; 20 import org.eclipse.osgi.service.datalocation.Location; 21 22 27 public class EclipseHomeVariableResolver implements IDynamicVariableResolver { 28 29 public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { 30 Location installLocation = Platform.getInstallLocation(); 31 if (installLocation != null) { 32 URL url = installLocation.getURL(); 33 if (url != null) { 34 String file = url.getFile(); 35 if (file.length() != 0) { 36 return file; 37 } 38 } 39 } 40 return null; 41 } 42 43 } 44 | Popular Tags |