1 11 package org.eclipse.help.ui.internal.ide; 12 import org.eclipse.core.runtime.*; 13 import org.eclipse.help.internal.base.*; 14 import org.eclipse.help.ui.internal.util.*; 15 import org.eclipse.help.ui.internal.workingset.*; 16 import org.eclipse.ui.*; 17 import org.eclipse.ui.plugin.*; 18 import org.osgi.framework.*; 19 20 23 public class HelpIdePlugin extends AbstractUIPlugin { 24 public final static String PLUGIN_ID = "org.eclipse.help.ide"; public static boolean DEBUG = false; 27 28 private static HelpIdePlugin plugin; 29 private static BundleContext bundleContext; 30 private HelpWorkingSetSynchronizer workingSetListener; 31 32 37 public static synchronized void logError(String message, Throwable ex) { 38 if (message == null) 39 message = ""; Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, 41 message, ex); 42 HelpBasePlugin.getDefault().getLog().log(errorStatus); 43 } 44 49 public static synchronized void logWarning(String message) { 50 if (HelpBasePlugin.DEBUG) { 51 if (message == null) 52 message = ""; Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID, 54 IStatus.OK, message, null); 55 HelpBasePlugin.getDefault().getLog().log(warningStatus); 56 } 57 } 58 59 64 public static HelpIdePlugin getDefault() { 65 return plugin; 66 } 67 72 public void stop(BundleContext context) throws Exception { 73 if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_WORKBENCH) { 74 if (PlatformUI.isWorkbenchRunning()) { 75 PlatformUI.getWorkbench().getWorkingSetManager() 76 .removePropertyChangeListener(workingSetListener); 77 } 78 BaseHelpSystem.getWorkingSetManager().removePropertyChangeListener( 79 workingSetListener); 80 } 81 plugin = null; 82 bundleContext = null; 83 super.stop(context); 84 } 85 86 91 public void start(BundleContext context) throws Exception { 92 super.start(context); 93 plugin = this; 94 bundleContext = context; 95 DEBUG = isDebugging(); 97 98 BaseHelpSystem.setDefaultErrorUtil(new ErrorUtil()); 99 if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_WORKBENCH) { 100 if (PlatformUI.isWorkbenchRunning()) { 101 workingSetListener = new HelpWorkingSetSynchronizer(); 104 PlatformUI.getWorkbench().getWorkingSetManager() 105 .addPropertyChangeListener(workingSetListener); 106 BaseHelpSystem.getWorkingSetManager() 107 .addPropertyChangeListener(workingSetListener); 108 } else { 109 } 111 } 112 } 113 114 public HelpWorkingSetSynchronizer getWorkingSetSynchronizer() { 115 return workingSetListener; 116 } 117 } 118 | Popular Tags |