|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2008 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 11-29
Link Here
|
| 11 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
| 12 |
package org.eclipse.ui.internal.views.log; |
12 |
package org.eclipse.ui.internal.views.log; |
| 13 |
|
13 |
|
|
|
14 |
import org.eclipse.core.runtime.*; |
| 14 |
import org.eclipse.jface.resource.ImageDescriptor; |
15 |
import org.eclipse.jface.resource.ImageDescriptor; |
| 15 |
import org.eclipse.jface.resource.ImageRegistry; |
16 |
import org.eclipse.jface.resource.ImageRegistry; |
|
|
17 |
import org.eclipse.ui.*; |
| 16 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
18 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
| 17 |
import org.osgi.framework.BundleContext; |
19 |
import org.osgi.framework.BundleContext; |
| 18 |
|
20 |
|
| 19 |
/** |
21 |
/** |
| 20 |
* The activator class controls the plug-in life cycle |
22 |
* The activator class controls the plug-in life cycle |
| 21 |
*/ |
23 |
*/ |
| 22 |
public class Activator extends AbstractUIPlugin { |
24 |
public class Activator extends AbstractUIPlugin implements ILogListener { |
| 23 |
|
25 |
|
| 24 |
// The plug-in ID |
26 |
// The plug-in ID |
| 25 |
public static final String PLUGIN_ID = "org.eclipse.ui.views.log"; //$NON-NLS-1$ |
27 |
public static final String PLUGIN_ID = "org.eclipse.ui.views.log"; //$NON-NLS-1$ |
| 26 |
|
28 |
|
|
|
29 |
public static class Startup implements IStartup { |
| 30 |
|
| 31 |
public void earlyStartup() { |
| 32 |
Platform.addLogListener(Activator.getDefault()); |
| 33 |
} |
| 34 |
|
| 35 |
} |
| 36 |
|
| 27 |
// The shared instance |
37 |
// The shared instance |
| 28 |
private static Activator plugin; |
38 |
private static Activator plugin; |
| 29 |
|
39 |
|
|
Lines 49-54
Link Here
|
| 49 |
public void stop(BundleContext context) throws Exception { |
59 |
public void stop(BundleContext context) throws Exception { |
| 50 |
plugin = null; |
60 |
plugin = null; |
| 51 |
super.stop(context); |
61 |
super.stop(context); |
|
|
62 |
Platform.removeLogListener(this); |
| 52 |
} |
63 |
} |
| 53 |
|
64 |
|
| 54 |
public static Activator getDefault() { |
65 |
public static Activator getDefault() { |
|
Lines 88-91
Link Here
|
| 88 |
return imageDescriptorFromPlugin(PLUGIN_ID, id); |
99 |
return imageDescriptorFromPlugin(PLUGIN_ID, id); |
| 89 |
} |
100 |
} |
| 90 |
|
101 |
|
|
|
102 |
public void logging(IStatus status, String plugin) { |
| 103 |
// initializes logview on first comming log entry |
| 104 |
final IWorkbench workbench = PlatformUI.getWorkbench(); |
| 105 |
workbench.getDisplay().asyncExec(new Runnable() { |
| 106 |
public void run() { |
| 107 |
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); |
| 108 |
if (window != null) { |
| 109 |
try { |
| 110 |
window.getActivePage().showView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$ |
| 111 |
} catch (PartInitException e) { // empty |
| 112 |
} |
| 113 |
} |
| 114 |
} |
| 115 |
}); |
| 116 |
} |
| 91 |
} |
117 |
} |