package com.sonatype.buildserver.eclipse.ui;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;
extends AbstractUIPlugin
{
public final static String PLUGIN_ID = "org.sonatype.m2e.hudson.ui";
private static HudsonUIActivator plugin;
private static BundleContext context = null;
private ServiceTracker proxyServiceTracker;
{
}
public void start( BundleContext context )
throws Exception
{
super.start( context );
plugin = this;
HudsonUIActivator.context = context;
proxyServiceTracker = new ServiceTracker( context, IProxyService.class.getName(), null );
proxyServiceTracker.open();
}
public void stop( BundleContext context )
throws Exception
{
HudsonUIActivator.context = null;
try
{
proxyServiceTracker.close();
proxyServiceTracker = null;
}
finally
{
plugin = null;
super.stop( context );
}
}
{
return plugin;
}
{
return (IProxyService) proxyServiceTracker.getService();
}
{
ImageRegistry imageRegistry = getImageRegistry();
if ( imageRegistry != null )
{
ImageDescriptor imageDescriptor = imageRegistry.getDescriptor( path );
if ( imageDescriptor == null )
{
imageDescriptor = imageDescriptorFromPlugin( PLUGIN_ID, path );
imageRegistry.put( path, imageDescriptor );
}
return imageDescriptor;
}
return null;
}
{
ImageRegistry imageRegistry = getImageRegistry();
if ( imageRegistry != null )
{
getImageDescriptor( path );
return imageRegistry.get( path );
}
return null;
}
{
return context;
}
}