1 11 package org.eclipse.help.ui.internal; 12 13 import org.eclipse.core.runtime.IStatus; 14 import org.eclipse.core.runtime.Platform; 15 import org.eclipse.core.runtime.Status; 16 import org.eclipse.core.runtime.jobs.Job; 17 import org.eclipse.help.internal.HelpPlugin; 18 import org.eclipse.help.internal.base.BaseHelpSystem; 19 import org.eclipse.help.internal.base.HelpBasePlugin; 20 import org.eclipse.help.internal.base.HelpEvaluationContext; 21 import org.eclipse.help.internal.dynamic.FilterResolver; 22 import org.eclipse.help.internal.search.federated.IndexerJob; 23 import org.eclipse.help.ui.internal.dynamic.FilterResolverExtension; 24 import org.eclipse.help.ui.internal.util.ErrorUtil; 25 import org.eclipse.jface.dialogs.ErrorDialog; 26 import org.eclipse.ui.IWorkbench; 27 import org.eclipse.ui.PlatformUI; 28 import org.eclipse.ui.plugin.AbstractUIPlugin; 29 import org.osgi.framework.BundleContext; 30 31 34 public class HelpUIPlugin extends AbstractUIPlugin { 35 36 public final static String PLUGIN_ID = "org.eclipse.help.ui"; public static boolean DEBUG = false; 39 public static boolean DEBUG_INFOPOP = false; 40 41 private static HelpUIPlugin plugin; 42 43 48 public static synchronized void logError(String message, Throwable ex) { 49 logError(message, ex, true, false); 50 } 51 52 public static synchronized void logError(String message, Throwable ex, boolean log, boolean openDialog) { 53 if (message == null) 54 message = ""; Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, ex); 56 HelpPlugin.getDefault().getLog().log(errorStatus); 57 if (openDialog) 58 ErrorDialog.openError(null, null, null, errorStatus); 59 } 60 61 66 public static HelpUIPlugin getDefault() { 67 return plugin; 68 } 69 70 75 public void stop(BundleContext context) throws Exception { 76 plugin = null; 77 Job.getJobManager().cancel(IndexerJob.FAMILY); 79 super.stop(context); 80 } 81 82 87 public void start(BundleContext context) throws Exception { 88 super.start(context); 89 plugin = this; 90 91 FilterResolver.setExtension(new FilterResolverExtension()); 92 HelpEvaluationContext.setContext(HelpUIEvaluationContext.getContext()); 93 94 DEBUG = isDebugging(); 97 if (DEBUG) { 98 DEBUG_INFOPOP = "true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID + "/debug/infopop")); } 100 101 if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_WORKBENCH) 102 BaseHelpSystem.setDefaultErrorUtil(new ErrorUtil()); 104 105 if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_WORKBENCH) { 106 IWorkbench workbench = PlatformUI.getWorkbench(); 109 if (workbench != null) { 110 HelpBasePlugin.setActivitySupport(new HelpActivitySupport(workbench)); 111 } 112 } 113 } 114 } 115 | Popular Tags |