package org.tigris.subversion.clientadapter.javahl;

import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;
import org.tigris.subversion.clientadapter.ISVNClientWrapper;
import org.tigris.subversion.svnclientadapter.ISVNClientAdapter;
import org.tigris.subversion.svnclientadapter.javahl.JhlClientAdapter;
import org.tigris.subversion.svnclientadapter.javahl.JhlClientAdapterFactory;

/**
 * The activator class controls the plug-in life cycle
 */
public class Activator extends Plugin implements ISVNClientWrapper{

	// The plug-in ID
	public static final String PLUGIN_ID = "org.tigris.subversion.clientadapter.javahl";

	// The shared instance
	private static Activator plugin;
	
	private String displayName;
	
	private String version;
	
	/**
	 * The constructor
	 */
	public Activator() {
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);
	}

	/**
	 * Returns the shared instance
	 *
	 * @return the shared instance
	 */
	public static Activator getDefault() {
		return plugin;
	}

	public ISVNClientAdapter getAdapter() {
		if (this.isAvailable())
			return new JhlClientAdapter();
		else
			return null;
	}

	public String getAdapterID() {
		return JhlClientAdapterFactory.JAVAHL_CLIENT;
	}

	public String getVersionString() {
		return getVersionSynchronized();
	}

	private synchronized String getVersionSynchronized() {
		if (version == null) {
			if (this.isAvailable()) {
				JhlClientAdapter adapter = new JhlClientAdapter();
				version = adapter.getNativeLibraryVersionString();
			} else
				version = "Not Available";
			}
		return version;
	}

	public boolean isAvailable() {
		return JhlClientAdapterFactory.isAvailable();
	}

	public void setDisplayName(String string) {
		displayName = string;
	}

	public String getDisplayName() {
		return displayName + " " + this.getVersionString();
	}

	public String getLoadErrors() {
		return JhlClientAdapterFactory.getLibraryLoadErrors();
	}

}

@@ -78,22 +78,103 @@
 runtime.
-Plugin
+IStatus;%0Aimport org.eclipse.core.runtime.Plugin;%0Aimport org.eclipse.core.runtime.Status
 ;%0Aimport
@@ -1974,24 +1974,26 @@
 );%0A%09%09%09%7D else
+ %7B
 %0A%09%09%09%09version
@@ -2013,16 +2013,101 @@
 able%22;%0A%09
+%09%09%09getLog().log(new Status(IStatus.INFO, PLUGIN_ID, 0, getLoadErrors(), null));%0A%09%09%09%7D%0A
 %09%09%7D%0A%09%09re

Put a message in the Eclipse log if the JavaHL library cannot load