3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.bulkeditor
.command
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.eclipse
.core
.expressions
.PropertyTester
;
15 import org
.eclipse
.ui
.IEditorInput
;
17 import eu
.etaxonomy
.taxeditor
.bulkeditor
.BulkEditor
;
18 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.AbstractBulkEditorInput
;
19 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.GroupEditorInput
;
20 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.OccurrenceEditorInput
;
21 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.TaxonEditorInput
;
24 * <p>BulkEditorPropertyTester class.</p>
30 public class BulkEditorPropertyTester
extends PropertyTester
{
32 @SuppressWarnings("unused")
33 private static final Logger logger
= Logger
34 .getLogger(BulkEditorPropertyTester
.class);
36 private static final String IS_MERGING_ENABLED
= "isMergingEnabled";
38 public static final String IS_GROUP_EDITOR
= "isGroupEditor";
39 public static final String IS_DERIVED_UNIT_EDITOR
= "isDerivedUnitEditor";
40 public static final String IS_TAXON_EDITOR
= "isTaxonEditor";
41 public static final String IS_CONVERT_ENABLED
= "isConvertingEnabled";
42 public static final String IS_PERSON
= "isPerson";
43 public static final String IS_TEAM
= "isTeam";
45 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
49 public boolean test(Object receiver
, String property
, Object
[] args
,
50 Object expectedValue
) {
51 BulkEditor bulkEditor
= null;
54 bulkEditor
= (BulkEditor
) receiver
;
55 if (IS_MERGING_ENABLED
.equals(property
)) {
56 IEditorInput input
= bulkEditor
.getEditorInput();
57 if (input
instanceof AbstractBulkEditorInput
) {
58 return ((AbstractBulkEditorInput
<?
>) input
).isMergingEnabled();
61 if (IS_CONVERT_ENABLED
.equals(property
)) {
62 IEditorInput input
= bulkEditor
.getEditorInput();
63 if (input
instanceof AbstractBulkEditorInput
) {
64 return ((AbstractBulkEditorInput
<?
>) input
).isConvertingEnabled();
67 else if(IS_GROUP_EDITOR
.equals(property
)){
68 return bulkEditor
.getEditorInput() instanceof GroupEditorInput
;
70 else if (IS_DERIVED_UNIT_EDITOR
.equals(property
)){
71 return bulkEditor
.getEditorInput() instanceof OccurrenceEditorInput
;
73 else if(IS_TAXON_EDITOR
.equals(property
)){
74 return bulkEditor
.getEditorInput() instanceof TaxonEditorInput
;
77 // if (("isPublishFlagEditingEnabled").equals(property)) {
78 // IEditorInput input = bulkEditor.getEditorInput();
79 // if (input instanceof NameEditorInput) {
80 // return ((NameEditorInput) input).isPublishFlagEnabled();