|
From: Robert E. <sky...@us...> - 2006-08-06 09:11:29
|
Update of /cvsroot/jcommander/plugins/org.jcommander.ui.app/src/org/jcommander/ui/app In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6470/src/org/jcommander/ui/app Modified Files: AppPlugin.java Log Message: All platform logs redirected to the application's log for better traceability. Index: AppPlugin.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.app/src/org/jcommander/ui/app/AppPlugin.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AppPlugin.java 7 Dec 2005 21:34:27 -0000 1.15 --- AppPlugin.java 6 Aug 2006 09:11:26 -0000 1.16 *************** *** 1,7 **** package org.jcommander.ui.app; ! import java.net.*; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.jface.preference.*; --- 1,8 ---- package org.jcommander.ui.app; ! import java.io.*; import java.util.*; + import org.apache.log4j.*; import org.eclipse.core.runtime.*; import org.eclipse.jface.preference.*; *************** *** 15,18 **** --- 16,22 ---- */ public class AppPlugin extends AbstractUIPlugin { + + final static private Logger log = Logger.getLogger(AppPlugin.class); + public static final String FILEPANEL_EXTENSION_POINT_NAME = "org.jcommander.ui.app.FileTab"; *************** *** 40,44 **** public static final String FIRST_STARTUP_KEY = "FIRST_STARTUP"; ! public static final String ID = "org.jcommander.ui.app"; /** --- 44,48 ---- public static final String FIRST_STARTUP_KEY = "FIRST_STARTUP"; ! public static final String PLUGIN_ID = "org.jcommander.ui.app"; /** *************** *** 48,58 **** super(); plugin = this; - // try { - // resourceBundle = ResourceBundle - // .getBundle("org.jcommander.ui.app.UiPluginResources"); - // } catch (MissingResourceException ex) { - // resourceBundle = null; - // MessageDisplayer.displayException(ex); - // } } --- 52,55 ---- *************** *** 62,69 **** public void start(BundleContext context) throws Exception { super.start(context); } ! public static URL getURLForFile(String fileName) { ! return plugin.find(new Path(fileName)); } --- 59,87 ---- public void start(BundleContext context) throws Exception { super.start(context); + + capturePlatformLogs(); } ! protected void capturePlatformLogs() { ! Platform.addLogListener(new ILogListener() { ! ! public void logging(IStatus status, String pPlugin) { ! ! Throwable exception = status.getException(); ! ! if(exception != null) { ! ! StringWriter writer = new StringWriter(); ! exception.printStackTrace(new PrintWriter(writer)); ! ! // All platform logs should make it to the application log ! log.error("Platform Exception: " + status.toString()); ! log.error("Stack trace: ", exception); ! } else { ! // Do nothing ! } ! } ! ! }); } |