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.
10 package eu
.etaxonomy
.taxeditor
.bulkeditor
.command
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.core
.expressions
.PropertyTester
;
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
;
27 public class BulkEditorPropertyTester
extends PropertyTester
{
29 @SuppressWarnings("unused")
30 private static final Logger logger
= Logger
31 .getLogger(BulkEditorPropertyTester
.class);
33 private static final String IS_MERGING_ENABLED
= "isMergingEnabled";
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";
44 public boolean test(Object receiver
, String property
, Object
[] args
,
45 Object expectedValue
) {
46 BulkEditorE4 bulkEditor
= null;
48 bulkEditor
= (BulkEditorE4
) receiver
;
49 if (IS_MERGING_ENABLED
.equals(property
)) {
50 AbstractBulkEditorInput
<?
> input
= bulkEditor
.getEditorInput();
51 return ((AbstractBulkEditorInput
<?
>) input
).isMergingEnabled();
53 if (IS_CONVERT_ENABLED
.equals(property
)) {
54 AbstractBulkEditorInput
<?
> input
= bulkEditor
.getEditorInput();
55 return ((AbstractBulkEditorInput
<?
>) input
).isConvertingEnabled();
57 else if(IS_GROUP_EDITOR
.equals(property
)){
58 return bulkEditor
.getEditorInput() instanceof GroupEditorInput
;
60 else if (IS_DERIVED_UNIT_EDITOR
.equals(property
)){
61 return bulkEditor
.getEditorInput() instanceof OccurrenceEditorInput
;
63 else if(IS_TAXON_EDITOR
.equals(property
)){
64 return bulkEditor
.getEditorInput() instanceof TaxonEditorInput
;
66 else if(IS_MEDIA_EDITOR
.equals(property
)){
67 return bulkEditor
.getEditorInput() instanceof MediaEditorInput
;