KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > part > services > SystemLog


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.part.services;
12
13 import org.eclipse.core.runtime.ILog;
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.Platform;
16 import org.eclipse.ui.internal.part.components.services.IStatusFactory;
17 import org.eclipse.ui.internal.part.components.services.ISystemLog;
18 import org.osgi.framework.Bundle;
19
20 /**
21  * @since 3.1
22  */

23 public class SystemLog implements ISystemLog {
24     
25     private IStatusFactory factory;
26     private Bundle pluginBundle;
27     
28     public SystemLog(Bundle pluginBundle, IStatusFactory factory) {
29         this.pluginBundle = pluginBundle;
30         this.factory = factory;
31     }
32     
33     /* (non-Javadoc)
34      * @see org.eclipse.ui.component.services.IErrorContext#log(org.eclipse.core.runtime.IStatus)
35      */

36     public void log(IStatus toLog) {
37         ILog log = Platform.getLog(pluginBundle);
38         if (log != null) {
39             log.log(toLog);
40         }
41     }
42
43     /* (non-Javadoc)
44      * @see org.eclipse.ui.component.services.IErrorContext#log(java.lang.Throwable)
45      */

46     public void log(Throwable JavaDoc t) {
47         log(factory.newError(t));
48     }
49
50 }
51
Popular Tags