Project

General

Profile

Download (1.65 KB) Statistics
| Branch: | Tag: | Revision:
1 ca22953d Andreas Müller
package eu.etaxonomy.taxeditor.editor.validation;
2
3
import org.apache.log4j.Logger;
4
import org.eclipse.core.runtime.IProgressMonitor;
5
import org.eclipse.ui.IMemento;
6
7
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
8
import eu.etaxonomy.taxeditor.model.IContextListener;
9
10
/**
11
 * An {@code IContextListener} responsible for starting the
12
 * {@link ValidationDaemon}.
13
 * 
14
 * @see TaxeditorEditorPlugin#start(org.osgi.framework.BundleContext)
15
 * 
16
 * @author ayco_holleman
17
 * 
18
 */
19
public class ValidationContextListener implements IContextListener {
20
21
	@SuppressWarnings("unused")
22
	private static final Logger logger = Logger.getLogger(ValidationContextListener.class);
23
24
	private ValidationDaemon daemon;
25
26
27
	public ValidationContextListener(){
28
	}
29
30
31
	@Override
32
	public void contextAboutToStop(IMemento memento, IProgressMonitor monitor){
33
		if (daemon != null) {
34
			daemon.cancel();
35
			daemon.setCancelRequested();
36
		}
37
	}
38
39
40
	@Override
41
	public void contextStop(IMemento memento, IProgressMonitor monitor){
42
		if (daemon != null) {
43
			daemon.cancel();
44
			daemon.setCancelRequested();
45
		}
46
	}
47
48
49
	@Override
50
	public void contextStart(IMemento memento, IProgressMonitor monitor){
51
		if (daemon == null) {
52
			daemon = new ValidationDaemon();
53
		}
54
		daemon.schedule();
55
	}
56
57
58
	@Override
59
	public void contextRefresh(IProgressMonitor monitor){
60
		if (daemon != null) {
61
			daemon.cancel();
62
			daemon.setCancelRequested();
63
		}
64
	}
65
66
67
	@Override
68
	public void workbenchShutdown(IMemento memento, IProgressMonitor monitor){
69
		if (daemon != null) {
70
			daemon.cancel();
71
			daemon.setCancelRequested();
72
			daemon = null;
73
		}
74
	}
75
76
}