2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.bulkeditor
.command
;
11 import org
.apache
.logging
.log4j
.LogManager
;import org
.apache
.logging
.log4j
.Logger
;
12 import org
.eclipse
.core
.expressions
.PropertyTester
;
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
;
25 public class BulkEditorPropertyTester
extends PropertyTester
{
27 @SuppressWarnings("unused")
28 private static final Logger logger
= LogManager
.getLogger(BulkEditorPropertyTester
.class);
30 private static final String IS_MERGING_ENABLED
= "isMergingEnabled";
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";
41 public boolean test(Object receiver
, String property
, Object
[] args
,
42 Object expectedValue
) {
43 BulkEditor bulkEditor
= null;
45 bulkEditor
= (BulkEditor
) receiver
;
46 if (IS_MERGING_ENABLED
.equals(property
)) {
47 AbstractBulkEditorInput
<?
> input
= bulkEditor
.getEditorInput();
48 return ((AbstractBulkEditorInput
<?
>) input
).isMergingEnabled();
50 if (IS_CONVERT_ENABLED
.equals(property
)) {
51 AbstractBulkEditorInput
<?
> input
= bulkEditor
.getEditorInput();
52 return ((AbstractBulkEditorInput
<?
>) input
).isConvertingEnabled();
54 else if(IS_GROUP_EDITOR
.equals(property
)){
55 return bulkEditor
.getEditorInput() instanceof GroupEditorInput
;
57 else if (IS_DERIVED_UNIT_EDITOR
.equals(property
)){
58 return bulkEditor
.getEditorInput() instanceof OccurrenceEditorInput
;
60 else if(IS_TAXON_EDITOR
.equals(property
)){
61 return bulkEditor
.getEditorInput() instanceof TaxonEditorInput
;
63 else if(IS_MEDIA_EDITOR
.equals(property
)){
64 return bulkEditor
.getEditorInput() instanceof MediaEditorInput
;