2 * Copyright (C) 2015 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
.eclipse
.core
.expressions
.PropertyTester
;
12 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
14 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
15 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
22 public class BulkEditorMenuPropertyTester
extends PropertyTester
{
25 private static final String IS_TEAM
= "isTeam";
26 private static final String IS_PERSON
= "isPerson";
27 private static final String IS_TEAM_OR_PERSON
= "isTeamOrPerson";
29 public BulkEditorMenuPropertyTester(){
35 public boolean test(Object receiver
, String property
, Object
[] args
,
36 Object expectedValue
) {
37 if(receiver
instanceof IStructuredSelection
){
38 IStructuredSelection selection
= (IStructuredSelection
) receiver
;
39 Object selectedElement
= selection
.getFirstElement();
40 if (property
.equals(IS_TEAM_OR_PERSON
) && (selectedElement
instanceof Team
|| selectedElement
instanceof Person
)){
43 if (property
.equals(IS_PERSON
) && selectedElement
instanceof Person
){
46 if (property
.equals(IS_TEAM
) && selectedElement
instanceof Team
){