1 package eu
.etaxonomy
.taxeditor
.bulkeditor
.command
;
3 import org
.eclipse
.core
.expressions
.PropertyTester
;
4 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
5 import org
.eclipse
.jface
.viewers
.TreeNode
;
7 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
8 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.BulkEditorInputType
;
10 public class BulkEditorSelectionPropertyTester
extends PropertyTester
{
12 public static final String IS_BULK_EDITOR_SUPPORTED
= "isBulkEditorSupported";
15 public boolean test(Object receiver
, String property
, Object
[] args
,
16 Object expectedValue
) {
17 if(IS_BULK_EDITOR_SUPPORTED
.equals(property
)){
18 if(receiver
instanceof IStructuredSelection
){
19 IStructuredSelection selection
= (IStructuredSelection
) receiver
;
20 Object selectedElement
= selection
.getFirstElement();
21 if(selectedElement
!=null){
22 if(selectedElement
instanceof UuidAndTitleCache
){
23 return BulkEditorInputType
.getByType(((UuidAndTitleCache
) selectedElement
).getType())!=null;
25 else if(selectedElement
instanceof TreeNode
){
26 System
.out
.println(BulkEditorInputType
.getByType(((TreeNode
) selectedElement
).getValue().getClass())!=null);
27 return BulkEditorInputType
.getByType(((TreeNode
) selectedElement
).getValue().getClass())!=null;
29 return BulkEditorInputType
.getByType(selectedElement
.getClass())!=null;