Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java')
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java72
1 files changed, 42 insertions, 30 deletions
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java b/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java
index f1cd49c84..2cb7779fa 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java
@@ -1,36 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
+/***************************************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
+ * Contributors: IBM Corporation - initial API and implementation
+ **************************************************************************************************/
package org.eclipse.help.internal;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.context.*;
-import org.eclipse.help.internal.toc.*;
-import org.eclipse.help.internal.index.*;
-import org.eclipse.help.internal.util.*;
-import org.osgi.framework.*;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IExtensionDelta;
+import org.eclipse.core.runtime.IRegistryChangeEvent;
+import org.eclipse.core.runtime.IRegistryChangeListener;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.help.internal.context.ContextManager;
+import org.eclipse.help.internal.index.IndexManager;
+import org.eclipse.help.internal.toc.TocManager;
+import org.eclipse.help.internal.util.ResourceLocator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+
/**
* Help System Core plug-in
*/
-public class HelpPlugin extends Plugin
- implements
- IRegistryChangeListener,
- BundleListener {
+public class HelpPlugin extends Plugin implements IRegistryChangeListener, BundleListener {
+
public final static String PLUGIN_ID = "org.eclipse.help"; //$NON-NLS-1$
// debug options
public static boolean DEBUG = false;
public static boolean DEBUG_CONTEXT = false;
public static boolean DEBUG_PROTOCOLS = false;
protected static HelpPlugin plugin;
-// private static BundleContext bundleContext;
+ // private static BundleContext bundleContext;
private List tocsChangedListeners = new Vector();
public final static String BASE_TOCS_KEY = "baseTOCS"; //$NON-NLS-1$
@@ -48,16 +56,17 @@ public class HelpPlugin extends Plugin
public static synchronized void logError(String message, Throwable ex) {
if (message == null)
message = ""; //$NON-NLS-1$
- Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
- message, ex);
+ Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, ex);
logStatus(errorStatus);
}
+
/**
* Logs an IStatus
*/
private static void logStatus(IStatus errorStatus) {
HelpPlugin.getDefault().getLog().log(errorStatus);
}
+
/**
* Logs a Warning message with an exception.
*/
@@ -65,8 +74,7 @@ public class HelpPlugin extends Plugin
if (HelpPlugin.DEBUG) {
if (message == null)
message = ""; //$NON-NLS-1$
- Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID,
- IStatus.OK, message, null);
+ Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID, IStatus.OK, message, null);
HelpPlugin.getDefault().getLog().log(warningStatus);
}
}
@@ -77,6 +85,7 @@ public class HelpPlugin extends Plugin
public static HelpPlugin getDefault() {
return plugin;
}
+
/*
* (non-Javadoc)
*
@@ -86,7 +95,7 @@ public class HelpPlugin extends Plugin
Platform.getExtensionRegistry().removeRegistryChangeListener(this);
context.removeBundleListener(this);
plugin = null;
-// bundleContext = null;
+ // bundleContext = null;
super.stop(context);
}
@@ -98,10 +107,9 @@ public class HelpPlugin extends Plugin
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
-// bundleContext = context;
+ // bundleContext = context;
context.addBundleListener(this);
- Platform.getExtensionRegistry().addRegistryChangeListener(this,
- HelpPlugin.PLUGIN_ID);
+ Platform.getExtensionRegistry().addRegistryChangeListener(this, HelpPlugin.PLUGIN_ID);
// Setup debugging options
DEBUG = isDebugging();
if (DEBUG) {
@@ -109,6 +117,7 @@ public class HelpPlugin extends Plugin
DEBUG_PROTOCOLS = "true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID + "/debug/protocols")); //$NON-NLS-1$ //$NON-NLS-2$
}
}
+
/**
* Used to obtain Toc Naviagiont Manager
*
@@ -124,6 +133,7 @@ public class HelpPlugin extends Plugin
}
return getDefault().tocManager;
}
+
/**
* Used to obtain Context Manager returns an instance of ContextManager
*/
@@ -132,14 +142,14 @@ public class HelpPlugin extends Plugin
getDefault().contextManager = new ContextManager();
return getDefault().contextManager;
}
+
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
*/
public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] deltas = event.getExtensionDeltas(
- HelpPlugin.PLUGIN_ID, TocManager.TOC_XP_NAME);
+ IExtensionDelta[] deltas = event.getExtensionDeltas(HelpPlugin.PLUGIN_ID, TocManager.TOC_XP_NAME);
if (deltas.length > 0) {
tocManager = null;
}
@@ -150,11 +160,13 @@ public class HelpPlugin extends Plugin
}
}
}
+
public void addTocsChangedListener(ITocsChangedListener listener) {
if (!tocsChangedListeners.contains(listener)) {
tocsChangedListeners.add(listener);
}
}
+
public void removeTocsChangedListener(ITocsChangedListener listener) {
tocsChangedListeners.remove(listener);
}

Back to the top