|
Lines 11-25
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, IStartup { |
| 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$ |
|
Lines 40-45
Link Here
|
| 40 |
public void start(BundleContext context) throws Exception { |
42 |
public void start(BundleContext context) throws Exception { |
| 41 |
super.start(context); |
43 |
super.start(context); |
| 42 |
plugin = this; |
44 |
plugin = this; |
|
|
45 |
Platform.addLogListener(this); |
| 43 |
} |
46 |
} |
| 44 |
|
47 |
|
| 45 |
/* |
48 |
/* |
|
Lines 47-52
Link Here
|
| 47 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) |
50 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) |
| 48 |
*/ |
51 |
*/ |
| 49 |
public void stop(BundleContext context) throws Exception { |
52 |
public void stop(BundleContext context) throws Exception { |
|
|
53 |
Platform.removeLogListener(this); |
| 50 |
plugin = null; |
54 |
plugin = null; |
| 51 |
super.stop(context); |
55 |
super.stop(context); |
| 52 |
} |
56 |
} |
|
Lines 88-91
Link Here
|
| 88 |
return imageDescriptorFromPlugin(PLUGIN_ID, id); |
92 |
return imageDescriptorFromPlugin(PLUGIN_ID, id); |
| 89 |
} |
93 |
} |
| 90 |
|
94 |
|
|
|
95 |
public void logging(IStatus status, String plugin) { |
| 96 |
|
| 97 |
// initializes logview on first comming log entry and unregisters listener |
| 98 |
final IWorkbench workbench = PlatformUI.getWorkbench(); |
| 99 |
workbench.getDisplay().asyncExec(new Runnable() { |
| 100 |
public void run() { |
| 101 |
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); |
| 102 |
if (window != null) { |
| 103 |
try { |
| 104 |
window.getActivePage().showView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$ |
| 105 |
Platform.removeLogListener(Activator.this); // don't need listener as logview showed up |
| 106 |
} catch (PartInitException e) { // empty |
| 107 |
} |
| 108 |
} |
| 109 |
} |
| 110 |
}); |
| 111 |
} |
| 112 |
|
| 113 |
public void earlyStartup() { |
| 114 |
// empty - all initialization is in start(BundleContext) |
| 115 |
} |
| 116 |
|
| 91 |
} |
117 |
} |