blob: 947b1ea81cca0c5767b94d0694c6b828c2c8c43b [file] [log] [blame]
package org.eclipse.ant.tests.core.testplugin;
/**********************************************************************
Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
This file is made available under the terms of the Common Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/cpl-v10.html
**********************************************************************/
import java.io.File;
import java.io.IOException;
import java.net.URL;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.ui.plugin.AbstractUIPlugin;
public class AntTestPlugin extends AbstractUIPlugin {
private static AntTestPlugin deflt;
public AntTestPlugin(IPluginDescriptor descriptor) {
super(descriptor);
deflt= this;
}
public static AntTestPlugin getDefault() {
return deflt;
}
public static IWorkspace getWorkspace() {
return ResourcesPlugin.getWorkspace();
}
public static void enableAutobuild(boolean enable) throws CoreException {
// disable auto build
IWorkspace workspace= AntTestPlugin.getWorkspace();
IWorkspaceDescription desc= workspace.getDescription();
desc.setAutoBuilding(enable);
workspace.setDescription(desc);
}
public File getFileInPlugin(IPath path) {
try {
URL installURL= new URL(getDescriptor().getInstallURL(), path.toString());
URL localURL= Platform.asLocalURL(installURL);
return new File(localURL.getFile());
} catch (IOException e) {
return null;
}
}
}