Home » Eclipse Projects » Eclipse 4 » Custom StatusReporter (or how to override WorkbenchStatusReporter)
Custom StatusReporter (or how to override WorkbenchStatusReporter) [message #915747] |
Mon, 17 September 2012 18:23  |
Eclipse User |
|
|
|
I need to change some of the behavior in WorkbenchStatusReporter.
Ideally I would like to extend WorkbenchStatusReporter and override the report method.
In PartRenderingEngine I can see where the status reporter is pulled from the context:
public void eventLoopException(Throwable exception) {
StatusReporter statusReporter = (StatusReporter) appContext
.get(StatusReporter.class.getName());
if (statusReporter != null) {
statusReporter.show(StatusReporter.ERROR,
"Internal Error", exception);
} else {
if (logger != null) {
logger.error(exception);
}
}
}
I thought I would be able to add my own with the following:
lContext.set(StatusReporter.class.getName(), new MyCustomStatusReporter());
But my custom one is never used; the code that gets the status reporter in PartRenderingEngine always ends up invoking StatusReporterCreationFunction (which creates an instance of WorkbenchStatusReporter).
How can I specify my own implementation of StatusReporter to replace/extend the WorkbenchStatusReporter?
|
|
| | | |
Re: Custom StatusReporter (or how to override WorkbenchStatusReporter) [message #981916 is a reply to message #981882] |
Mon, 12 November 2012 15:06   |
Eclipse User |
|
|
|
The build.properties includes the OSGI-INF directory:
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
css/default.css,\
Application.e4xmi,\
conf/,\
com.company.blah.productname.product,\
images/,\
OSGI-INF/
source.. = src/,\
conf/
src.includes = images/
And the MANIFEST.MF contains the lazy activation policy:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.company.blah.productname
Bundle-SymbolicName: com.company.blah.productname; singleton:=true
Bundle-Version: 2.0.4
Bundle-Activator: com.company.blah.productname.Activator
Bundle-Vendor: company
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: com.company.framework,
com.company.blah.lib
Require-Bundle: javax.inject;bundle-version="1.0.0",
org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.swt;bundle-version="3.100.0",
org.eclipse.core.databinding;bundle-version="1.4.1",
org.eclipse.core.databinding.beans;bundle-version="1.2.200",
org.eclipse.jface;bundle-version="3.8.0",
org.eclipse.jface.databinding;bundle-version="1.6.0",
org.eclipse.e4.ui.services;bundle-version="0.10.1",
org.eclipse.e4.ui.workbench;bundle-version="0.10.2",
org.eclipse.e4.core.services;bundle-version="1.0.0",
org.eclipse.e4.core.di;bundle-version="1.1.0",
org.eclipse.e4.core.contexts;bundle-version="1.1.0",
org.eclipse.e4.ui.workbench.swt;bundle-version="0.10.1",
org.eclipse.core.databinding.property;bundle-version="1.4.100",
org.eclipse.e4.ui.css.core;bundle-version="0.10.1",
org.w3c.css.sac;bundle-version="1.3.1",
org.eclipse.e4.core.commands;bundle-version="0.10.1",
org.eclipse.e4.ui.bindings;bundle-version="0.10.1",
org.eclipse.ui;bundle-version="3.103.0",
org.eclipse.ui.forms;bundle-version="3.5.200",
com.company.blah.lib,
com.company.productname2.model,
com.company.framework,
com.company.productname2.business,
com.company.productname2.model;bundle-version="1.6.0",
org.eclipse.osgi.services;bundle-version="3.3.100",
org.eclipse.nebula.widgets.datechooser;bundle-version="1.0.0",
javax.annotation;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.company.common.model.reporting,
com.company.lassen.reporting,
com.company.lib,
com.company.blah.lib.swt,
org.eclipse.e4.core.di.extensions,
org.eclipse.e4.ui.di,
org.osgi.framework;version="1.3.0",
org.osgi.service.event;version="1.3.0"
Service-Component: OSGI-INF/StatusReporter.xml
|
|
| | |
Re: Custom StatusReporter (or how to override WorkbenchStatusReporter) [message #985707 is a reply to message #915747] |
Thu, 15 November 2012 13:13  |
Eclipse User |
|
|
|
I ended up removing the XML file and reference in the manifest and did it programmatically via my Activator:
public void start(BundleContext bundleContext) throws Exception {
Dictionary<String, Object> properties = new Hashtable<String, Object>();
properties.put("service.context.key", "org.eclipse.e4.core.services.statusreporter.StatusReporter");
StatusReporterContextFunction implementation = new StatusReporterContextFunction();
bundleContext.registerService("org.eclipse.e4.core.contexts.IContextFunction", implementation, properties);
Activator.context = bundleContext;
}
|
|
|
Goto Forum:
Current Time: Tue Jul 22 20:12:56 EDT 2025
Powered by FUDForum. Page generated in 0.04899 seconds
|