KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > EclipseHomeInitializer


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.core;
12
13
14 import org.eclipse.core.runtime.CoreException;
15 import org.eclipse.core.runtime.Path;
16 import org.eclipse.core.runtime.Preferences;
17 import org.eclipse.jdt.core.ClasspathVariableInitializer;
18 import org.eclipse.jdt.core.JavaCore;
19
20 public class EclipseHomeInitializer extends ClasspathVariableInitializer {
21
22     public static final String JavaDoc ECLIPSE_HOME_VARIABLE = "ECLIPSE_HOME"; //$NON-NLS-1$
23

24     /**
25      * @see ClasspathVariableInitializer#initialize(String)
26      */

27     public void initialize(String JavaDoc variable) {
28         resetEclipseHomeVariable();
29     }
30
31     public static void resetEclipseHomeVariable() {
32         try {
33             Preferences pref = PDECore.getDefault().getPluginPreferences();
34             String JavaDoc platformHome = pref.getString(ICoreConstants.PLATFORM_PATH);
35             JavaCore.setClasspathVariable(
36                 ECLIPSE_HOME_VARIABLE,
37                 new Path(platformHome),
38                 null);
39         } catch (CoreException e) {
40         }
41     }
42 }
43
Popular Tags