diff options
author | Darin Wright | 2006-01-25 04:41:00 +0000 |
---|---|---|
committer | Darin Wright | 2006-01-25 04:41:00 +0000 |
commit | 37cd3cf0186a3abb7b241960f3e0764f3567f800 (patch) | |
tree | 3f5bfe48ffc1bbd376c8299c4cf4979a35b3d7d1 /org.eclipse.core.variables/src/org/eclipse/core | |
parent | 580adfa7073a07533719e0f7cb54af3e47c8a96d (diff) | |
download | eclipse.platform.debug-37cd3cf0186a3abb7b241960f3e0764f3567f800.tar.gz eclipse.platform.debug-37cd3cf0186a3abb7b241960f3e0764f3567f800.tar.xz eclipse.platform.debug-37cd3cf0186a3abb7b241960f3e0764f3567f800.zip |
Bug 119922 - mechanism to contribute VM install
Diffstat (limited to 'org.eclipse.core.variables/src/org/eclipse/core')
-rw-r--r-- | org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java new file mode 100644 index 000000000..17ca4a1a7 --- /dev/null +++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Bjorn Freeman-Benson - initial API and implementation + *******************************************************************************/ +package org.eclipse.core.internal.variables; + +import java.net.URL; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.variables.IDynamicVariable; +import org.eclipse.core.variables.IDynamicVariableResolver; +import org.eclipse.osgi.service.datalocation.Location; + +/** + * Resolver for ${eclipse_home} + * + * @since 3.2 + */ +public class EclipseHomeVariableResolver implements IDynamicVariableResolver { + + public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { + Location installLocation = Platform.getInstallLocation(); + if (installLocation != null) { + URL url = installLocation.getURL(); + if (url != null) { + String file = url.getFile(); + if (file.length() != 0) { + return file; + } + } + } + return null; + } + +} |