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 | |
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
3 files changed, 52 insertions, 0 deletions
diff --git a/org.eclipse.core.variables/plugin.properties b/org.eclipse.core.variables/plugin.properties index b15fcea9e..756af847a 100644 --- a/org.eclipse.core.variables/plugin.properties +++ b/org.eclipse.core.variables/plugin.properties @@ -13,3 +13,4 @@ pluginName=Core Variables providerName=Eclipse.org valueVariablesExtensionPointName=Value Variables dynamicVariablesExtensionPointName=Dynamic Variables +eclipse_home.description=The location of the base installation for the running platform diff --git a/org.eclipse.core.variables/plugin.xml b/org.eclipse.core.variables/plugin.xml index 5b85ef121..97246bb7f 100644 --- a/org.eclipse.core.variables/plugin.xml +++ b/org.eclipse.core.variables/plugin.xml @@ -4,5 +4,13 @@ <extension-point id="valueVariables" name="%valueVariablesExtensionPointName" schema="schema/valueVariables.exsd"/> <extension-point id="dynamicVariables" name="%dynamicVariablesExtensionPointName" schema="schema/dynamicVariables.exsd"/> + <extension + point="org.eclipse.core.variables.dynamicVariables"> + <variable + description="%eclipse_home.description" + name="eclipse_home" + resolver="org.eclipse.core.internal.variables.EclipseHomeVariableResolver" + supportsArgument="false"/> + </extension> </plugin> 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; + } + +} |