1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package lombok.eclipse;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.Bundle;
public class Eclipse {
private static final String DEFAULT_BUNDLE = "org.eclipse.jdt.core";
public static void error(String message) {
error(message, DEFAULT_BUNDLE, null);
}
public static void error(String message, Throwable error) {
error(message, DEFAULT_BUNDLE, error);
}
public static void error(String message, String bundleName) {
error(message, bundleName, null);
}
public static void error(String message, String bundleName, Throwable error) {
Bundle bundle = Platform.getBundle(bundleName);
if ( bundle == null ) {
System.err.printf("Can't find bundle %s while trying to report error:\n%s\n", bundleName, message);
return;
}
ILog log = Platform.getLog(bundle);
log.log(new Status(IStatus.ERROR, bundleName, message, error));
}
}
|