1
|
/**
|
2
|
* Copyright (C) 2011 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.editor;
|
10
|
|
11
|
import org.eclipse.core.runtime.IProgressMonitor;
|
12
|
import org.eclipse.ui.IMemento;
|
13
|
|
14
|
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
|
15
|
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
|
16
|
import eu.etaxonomy.taxeditor.model.MessagingUtils;
|
17
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
18
|
import eu.etaxonomy.taxeditor.store.UseObjectStore;
|
19
|
|
20
|
/**
|
21
|
* The context listener will call this class when a new context is started.
|
22
|
* It will reset the UseObjectStore to guarantee the static
|
23
|
* content of the store will be refreshed each time we load a new context.
|
24
|
* @author a.theys
|
25
|
* @author a.mueller
|
26
|
* @created mar 13, 2012
|
27
|
*/
|
28
|
public class UseObjectManager extends ContextListenerAdapter{
|
29
|
|
30
|
private static final String RESET_USAGE_DATA = Messages.UseObjectManager_RESET_DATA;
|
31
|
|
32
|
|
33
|
public UseObjectManager() {
|
34
|
CdmStore.getContextManager().addContextListener(this);
|
35
|
}
|
36
|
|
37
|
|
38
|
@Override
|
39
|
public void contextRefresh(IProgressMonitor monitor) {
|
40
|
monitor.subTask(RESET_USAGE_DATA);
|
41
|
MessagingUtils.warn(getClass(), RESET_USAGE_DATA);
|
42
|
UseObjectStore.reset();
|
43
|
}
|
44
|
|
45
|
|
46
|
@Override
|
47
|
public void contextStart(IMemento memento, IProgressMonitor monitor) {
|
48
|
// monitor.subTask("Starting the Uses View");
|
49
|
// MessagingUtils.warn(getClass(), "Starting Uses View warn");
|
50
|
UseObjectStore.reset();
|
51
|
}
|
52
|
|
53
|
|
54
|
}
|