1
|
/**
|
2
|
* Copyright (C) 2007 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
|
|
10
|
package eu.etaxonomy.taxeditor.bulkeditor.command;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
import org.eclipse.core.expressions.PropertyTester;
|
14
|
|
15
|
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
|
16
|
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
|
17
|
import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
|
18
|
import eu.etaxonomy.taxeditor.bulkeditor.input.MediaEditorInput;
|
19
|
import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
|
20
|
import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
|
21
|
|
22
|
/**
|
23
|
* @author p.ciardelli
|
24
|
* @created 21.09.2009
|
25
|
* @version 1.0
|
26
|
*/
|
27
|
public class BulkEditorPropertyTester extends PropertyTester {
|
28
|
|
29
|
@SuppressWarnings("unused")
|
30
|
private static final Logger logger = Logger
|
31
|
.getLogger(BulkEditorPropertyTester.class);
|
32
|
|
33
|
private static final String IS_MERGING_ENABLED = "isMergingEnabled";
|
34
|
|
35
|
public static final String IS_GROUP_EDITOR = "isGroupEditor";
|
36
|
public static final String IS_DERIVED_UNIT_EDITOR = "isDerivedUnitEditor";
|
37
|
public static final String IS_TAXON_EDITOR = "isTaxonEditor";
|
38
|
public static final String IS_CONVERT_ENABLED = "isConvertingEnabled";
|
39
|
public static final String IS_PERSON = "isPerson";
|
40
|
public static final String IS_TEAM = "isTeam";
|
41
|
public static final String IS_MEDIA_EDITOR = "isMediaEditor";
|
42
|
|
43
|
/** {@inheritDoc} */
|
44
|
@Override
|
45
|
public boolean test(Object receiver, String property, Object[] args,
|
46
|
Object expectedValue) {
|
47
|
BulkEditorE4 bulkEditor = null;
|
48
|
|
49
|
bulkEditor = (BulkEditorE4) receiver;
|
50
|
if (IS_MERGING_ENABLED.equals(property)) {
|
51
|
AbstractBulkEditorInput input = bulkEditor.getEditorInput();
|
52
|
return ((AbstractBulkEditorInput<?>) input).isMergingEnabled();
|
53
|
}
|
54
|
if (IS_CONVERT_ENABLED.equals(property)) {
|
55
|
AbstractBulkEditorInput input = bulkEditor.getEditorInput();
|
56
|
return ((AbstractBulkEditorInput<?>) input).isConvertingEnabled();
|
57
|
}
|
58
|
else if(IS_GROUP_EDITOR.equals(property)){
|
59
|
return bulkEditor.getEditorInput() instanceof GroupEditorInput;
|
60
|
}
|
61
|
else if (IS_DERIVED_UNIT_EDITOR.equals(property)){
|
62
|
return bulkEditor.getEditorInput() instanceof OccurrenceEditorInput;
|
63
|
}
|
64
|
else if(IS_TAXON_EDITOR.equals(property)){
|
65
|
return bulkEditor.getEditorInput() instanceof TaxonEditorInput;
|
66
|
}
|
67
|
else if(IS_MEDIA_EDITOR.equals(property)){
|
68
|
return bulkEditor.getEditorInput() instanceof MediaEditorInput;
|
69
|
}
|
70
|
return false;
|
71
|
}
|
72
|
}
|