Example usage for org.eclipse.jdt.core JavaCore setClasspathVariables

List of usage examples for org.eclipse.jdt.core JavaCore setClasspathVariables

Introduction

In this page you can find the example usage for org.eclipse.jdt.core JavaCore setClasspathVariables.

Prototype

public static void setClasspathVariables(String[] variableNames, IPath[] paths, IProgressMonitor monitor)
        throws JavaModelException 

Source Link

Document

Sets the values of all the given classpath variables at once.

Usage

From source file:org.eclipse.objectteams.otdt.tests.AbstractJavaModelTests.java

License:Open Source License

public void setUpJCLClasspathVariables(String compliance) throws JavaModelException, IOException {
    if ("1.5".equals(compliance)) {
        if (JavaCore.getClasspathVariable("JCL15_LIB") == null) {
            setupExternalJCL("jclMin1.5");
            JavaCore.setClasspathVariables(new String[] { "JCL15_LIB", "JCL15_SRC", "JCL_SRCROOT" },
                    new IPath[] { getExternalJCLPath(compliance), getExternalJCLSourcePath(compliance),
                            getExternalJCLRootSourcePath() },
                    null);/*w  w w. j a v  a2  s  .c o  m*/
        }
    } else {
        if (JavaCore.getClasspathVariable("JCL_LIB") == null) {
            setupExternalJCL("jclMin");
            JavaCore.setClasspathVariables(new String[] { "JCL_LIB", "JCL_SRC", "JCL_SRCROOT" }, new IPath[] {
                    getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath() }, null);
        }
    }
}

From source file:org.gw4e.eclipse.facade.SettingsManager.java

License:Open Source License

public static void setM2_REPO() throws JavaModelException, InterruptedException {
    Job job = new WorkspaceJob("GW4E set M2_REPO  Job") {
        @Override/*from  ww  w . j  av a  2s  .c om*/
        public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
            // This setting is done in the following pom.xml file :
            // .../test/graphwalker-swtbot-tests/pom.xml
            // It is used to setup the Eclipse environment before
            // running tests.
            // See the Setup method of swtbot tests classes
            IPath path = JavaCore.getClasspathVariable("M2_REPO");
            System.out.println("M2_REPO " + path);
            if (path == null) {
                String pathTorepo = System.getProperty("gw.mvn.repository", null);
                if (pathTorepo != null) {
                    System.out.println("M2_REPO " + pathTorepo);
                    path = new Path(pathTorepo);

                    JavaCore.setClasspathVariables(new String[] { "M2_REPO" }, new IPath[] { path }, monitor);
                    System.out.println("M2_REPO " + pathTorepo + " has been set...");
                }
            }

            return Status.OK_STATUS;
        }
    };
    job.setUser(true);
    job.schedule();
    job.join();
}