blob: e577e3785e1e09b8b4d07a5ab1f2f0eb5dd482d1 (
plain) (
blame)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/*******************************************************************************
* Copyright (c) 2004, 2008 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/
package org.eclipse.mylyn.internal.tasks.bugs;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.mylyn.commons.core.AbstractErrorReporter;
import org.eclipse.mylyn.internal.tasks.bugs.wizards.ErrorLogStatus;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* @author Steffen Pingel
*/
public class TasksBugsPlugin extends AbstractUIPlugin {
public static class BugReporter extends AbstractErrorReporter {
@Override
public int getPriority(IStatus status) {
if (status instanceof ErrorLogStatus) {
return PRIORITY_DEFAULT;
}
return PRIORITY_NONE;
//return getTaskErrorReporter().getPriority(status);
}
@Override
public void handle(final IStatus status) {
IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench != null) {
Display display = workbench.getDisplay();
if (display != null && !display.isDisposed()) {
display.asyncExec(new Runnable() {
public void run() {
getTaskErrorReporter().handle(status);
}
});
}
}
}
}
public static final String ID_PLUGIN = "org.eclipse.mylyn.tasks.bugs";
private static TasksBugsPlugin INSTANCE;
private static TaskErrorReporter taskErrorReporter;
public static TasksBugsPlugin getDefault() {
return INSTANCE;
}
public static synchronized TaskErrorReporter getTaskErrorReporter() {
if (taskErrorReporter == null) {
taskErrorReporter = new TaskErrorReporter();
}
return taskErrorReporter;
}
public TasksBugsPlugin() {
}
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
INSTANCE = this;
}
@Override
public void stop(BundleContext context) throws Exception {
INSTANCE = null;
super.stop(context);
}
}
|