/******************************************************************************* * Copyright (c) 2011 Sebastian Benz 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: * Sebastian Benz - initial API and implementation *******************************************************************************/ package org.xrepl.ui.internal; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; public class XreplActivator extends AbstractUIPlugin { private static BundleContext context; static BundleContext getContext() { return context; } private static XreplActivator INSTANCE; /* * (non-Javadoc) * * @see * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext * ) */ public void start(BundleContext bundleContext) throws Exception { super.start(bundleContext); XreplActivator.context = bundleContext; INSTANCE = this; } /* * (non-Javadoc) * * @see * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext bundleContext) throws Exception { XreplActivator.context = null; } public static XreplActivator getInstance() { return INSTANCE; } public static ImageDescriptor getImageDescriptor(String imageFilePath) { return imageDescriptorFromPlugin(INSTANCE.getBundle().getSymbolicName(), imageFilePath); } }