01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.core;
11:
12: import org.eclipse.core.runtime.CoreException;
13: import org.eclipse.core.runtime.Path;
14: import org.eclipse.core.runtime.Preferences;
15: import org.eclipse.jdt.core.ClasspathVariableInitializer;
16: import org.eclipse.jdt.core.JavaCore;
17:
18: public class EclipseHomeInitializer extends
19: ClasspathVariableInitializer {
20:
21: public static final String ECLIPSE_HOME_VARIABLE = "ECLIPSE_HOME"; //$NON-NLS-1$
22:
23: /**
24: * @see ClasspathVariableInitializer#initialize(String)
25: */
26: public void initialize(String variable) {
27: resetEclipseHomeVariable();
28: }
29:
30: public static void resetEclipseHomeVariable() {
31: try {
32: Preferences pref = PDECore.getDefault()
33: .getPluginPreferences();
34: String platformHome = pref
35: .getString(ICoreConstants.PLATFORM_PATH);
36: JavaCore.setClasspathVariable(ECLIPSE_HOME_VARIABLE,
37: new Path(platformHome), null);
38: } catch (CoreException e) {
39: }
40: }
41: }
|