summaryrefslogtreecommitdiff
path: root/eclipse/java/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathVariableInitializer.java
blob: d454cb1e0ee6e0b741c4eba91ff5e18af5a911bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// **********************************************************************
//
// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
// the EPL is available at http://www.eclipse.org/legal/epl-v10.html.
//
// **********************************************************************

package com.zeroc.slice2javaplugin.internal;

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.ClasspathVariableInitializer;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;

public class IceClasspathVariableInitializer extends ClasspathVariableInitializer
{
    private final static String VARIABLE_NAME = "ICE_JAR_HOME";

    @Override
    public void initialize(String variable)
    {
        if(variable.equals(VARIABLE_NAME))
        {
            update();
        }
    }

    public static void update()
    {
        IPath path = new Path(Configuration.getJarDir());
        try
        {
            JavaCore.setClasspathVariable(VARIABLE_NAME, path, null);
        }
        catch(JavaModelException e)
        {
            e.printStackTrace();
        }
    }
}