blob: 3d7fa813441dff05c2217ead1e796878287afcd2 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005 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
*******************************************************************************/
package org.eclipse.jdt.debug.testplugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstall2;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.environments.CompatibleEnvironment;
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.jdt.launching.environments.IExecutionEnvironmentAnalyzerDelegate;
/**
* @since 3.2
*
*/
public class AnalyzerJ2SE13x implements IExecutionEnvironmentAnalyzerDelegate {
/*
* (non-Javadoc)
*
* @see org.eclipse.jdt.launching.environments.IExecutionEnvironmentAnalyzer#analyze(org.eclipse.jdt.launching.IVMInstall,
* org.eclipse.core.runtime.IProgressMonitor)
*/
public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor) throws CoreException {
if (vm instanceof IVMInstall2) {
IVMInstall2 vm2 = (IVMInstall2) vm;
String javaVersion = vm2.getJavaVersion();
if (javaVersion != null) {
IExecutionEnvironment environment = JavaRuntime.getExecutionEnvironmentsManager()
.getEnvironment("org.eclipse.jdt.debug.tests.environment.j2se13x");
if (javaVersion.startsWith("1.3")) {
return new CompatibleEnvironment[] { new CompatibleEnvironment(environment, true)};
}
if (javaVersion.startsWith("1.4")) {
return new CompatibleEnvironment[] { new CompatibleEnvironment(environment, false)};
}
if (javaVersion.startsWith("1.5")) {
return new CompatibleEnvironment[] { new CompatibleEnvironment(environment, false)};
}
}
}
return new CompatibleEnvironment[0];
}
}