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