package org.jboss.tools.common.reddeer;
import java.io.File;
import java.io.IOException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
*
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext )
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
*
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
public static File getResources() {
return getResources("/");
}
public static File getResources(String path) {
Bundle bundle = Platform.getBundle("org.jboss.tools.runtime.reddeer");
try {
return new File(FileLocator.getBundleFile(bundle), "resources/" + path);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}