1 package eu
.etaxonomy
.taxeditor
.bulkeditor
.command
;
3 import org
.eclipse
.core
.expressions
.PropertyTester
;
4 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
6 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
7 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.BulkEditorInputType
;
9 public class BulkEditorSelectionPropertyTester
extends PropertyTester
{
11 public static final String IS_BULK_EDITOR_SUPPORTED
= "isBulkEditorSupported";
14 public boolean test(Object receiver
, String property
, Object
[] args
,
15 Object expectedValue
) {
16 if(IS_BULK_EDITOR_SUPPORTED
.equals(property
)){
17 if(receiver
instanceof IStructuredSelection
){
18 IStructuredSelection selection
= (IStructuredSelection
) receiver
;
19 Object selectedElement
= selection
.getFirstElement();
20 if(selectedElement
!=null){
21 if(selectedElement
instanceof UuidAndTitleCache
){
22 return BulkEditorInputType
.getByType(((UuidAndTitleCache
) selectedElement
).getType())!=null;
24 return BulkEditorInputType
.getByType(selectedElement
.getClass())!=null;