1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.taxeditor.preference;
|
12
|
|
13
|
import org.eclipse.core.expressions.PropertyTester;
|
14
|
|
15
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
16
|
|
17
|
/**
|
18
|
* @author n.hoffmann
|
19
|
* @created Jan 26, 2011
|
20
|
* @version 1.0
|
21
|
*/
|
22
|
public class CdmStorePropertyTester extends PropertyTester {
|
23
|
|
24
|
private static final String EDITOR_IS_CONNECTED_TO_DB = "isCdmStoreConnected";
|
25
|
private static final String IS_REMOTING = "isRemoting";
|
26
|
|
27
|
@Override
|
28
|
public boolean test(Object receiver, String property, Object[] args,
|
29
|
Object expectedValue) {
|
30
|
|
31
|
if(EDITOR_IS_CONNECTED_TO_DB.equals(property)){
|
32
|
return isCdmStoreConnected();
|
33
|
}
|
34
|
|
35
|
if(IS_REMOTING.equals(property)){
|
36
|
return isRemoting();
|
37
|
}
|
38
|
return false;
|
39
|
}
|
40
|
|
41
|
private boolean isCdmStoreConnected(){
|
42
|
boolean active = CdmStore.isActive();
|
43
|
return active;
|
44
|
}
|
45
|
|
46
|
private boolean isRemoting() {
|
47
|
return CdmStore.getCurrentSessionManager().isRemoting();
|
48
|
}
|
49
|
|
50
|
|
51
|
}
|