return (runtime != null && runtime.isAvailable());
}
public IStatus configure(IProgressMonitor monitor) {
try {
MavenRuntimeManager runtimeManager = MavenPlugin.getMavenRuntimeManager();
String path = location.getCanonicalPath();
MavenRuntime runtime = runtimeManager.getRuntime(path);
// Get the existing default runtime in case we need to revert later
oldDefaultRuntime = runtimeManager.getDefaultRuntime();
// If a runtime at the given path already exists make it the default
if (runtime != null && runtime.isAvailable()) {
if (!runtime.equals(oldDefaultRuntime)) {
runtimeManager.setDefaultRuntime(runtime);
}
setConfigured(true);
return new Status(IStatus.INFO, MavenCorePlugin.PLUGIN_ID, NLS.bind("Maven already configured at {0}", path));
}
else {
// Create a new runtime; install it and make the default
runtime = MavenRuntimeManager.createExternalRuntime(location.getCanonicalPath());
List<MavenRuntime> runtimes = runtimeManager.getMavenRuntimes();
runtimes.add(runtime);
runtimeManager.setRuntimes(runtimes);
runtimeManager.setDefaultRuntime(runtime);
setConfigured(true);
return new Status(IStatus.OK, MavenCorePlugin.PLUGIN_ID, NLS.bind("Maven successfully configured at {0}", location));
}
}
catch (Exception e) {