Revision 92634d22
Added by Patrick Plitzner over 7 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorSelectionPropertyTester.java | ||
---|---|---|
3 | 3 |
import org.eclipse.core.expressions.PropertyTester; |
4 | 4 |
import org.eclipse.jface.viewers.IStructuredSelection; |
5 | 5 |
|
6 |
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; |
|
6 | 7 |
import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType; |
7 | 8 |
|
8 | 9 |
public class BulkEditorSelectionPropertyTester extends PropertyTester { |
9 | 10 |
|
10 | 11 |
public static final String IS_BULK_EDITOR_SUPPORTED = "isBulkEditorSupported"; |
11 |
|
|
12 |
|
|
12 | 13 |
@Override |
13 | 14 |
public boolean test(Object receiver, String property, Object[] args, |
14 | 15 |
Object expectedValue) { |
... | ... | |
17 | 18 |
IStructuredSelection selection = (IStructuredSelection) receiver; |
18 | 19 |
Object selectedElement = selection.getFirstElement(); |
19 | 20 |
if(selectedElement!=null){ |
21 |
if(selectedElement instanceof UuidAndTitleCache){ |
|
22 |
return BulkEditorInputType.getByType(((UuidAndTitleCache) selectedElement).getType())!=null; |
|
23 |
} |
|
20 | 24 |
return BulkEditorInputType.getByType(selectedElement.getClass())!=null; |
21 | 25 |
} |
22 | 26 |
} |
23 | 27 |
} |
24 | 28 |
return false; |
25 | 29 |
} |
26 |
|
|
30 |
|
|
27 | 31 |
} |
Also available in: Unified diff
ref #5616 Fix class check for bulk editor porperty tester