Revision 1e816532
Added by Katja Luther almost 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodePropertyTester.java | ||
---|---|---|
7 | 7 |
*/ |
8 | 8 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
9 | 9 |
|
10 |
import java.util.ArrayList; |
|
11 | 10 |
import java.util.Collection; |
12 | 11 |
|
13 | 12 |
import org.eclipse.core.expressions.PropertyTester; |
14 | 13 |
|
15 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
16 | 14 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
17 | 15 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
16 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto; |
|
18 | 17 |
public class TaxonNodePropertyTester extends PropertyTester { |
19 |
|
|
18 |
|
|
20 | 19 |
private static final Object HAS_SYNONYMS = "hasSynonyms"; //$NON-NLS-1$ |
21 | 20 |
private static final Object HAS_TAXA = "hasTaxa"; //$NON-NLS-1$ |
22 | 21 |
private static final Object IS_CLASSIFICATION = "isClassification"; //$NON-NLS-1$ |
23 |
|
|
22 |
|
|
24 | 23 |
/** {@inheritDoc} */ |
25 |
public boolean test(Object receiver, String property, Object[] args, |
|
24 |
@Override |
|
25 |
public boolean test(Object receiver, String property, Object[] args, |
|
26 | 26 |
Object expectedValue) { |
27 | 27 |
if (receiver instanceof Collection){ |
28 | 28 |
if (((Collection)receiver).iterator().hasNext()){ |
... | ... | |
44 | 44 |
return false; |
45 | 45 |
} |
46 | 46 |
} |
47 |
if (receiver instanceof TaxonNode && IS_CLASSIFICATION.equals(property)) { |
|
48 |
TaxonNode node = (TaxonNode) receiver;
|
|
49 |
return !node.hasTaxon();
|
|
47 |
if (receiver instanceof TaxonNodeDto && IS_CLASSIFICATION.equals(property)) {
|
|
48 |
TaxonNodeDto node = (TaxonNodeDto) receiver;
|
|
49 |
return node.getTaxonUuid() == null;
|
|
50 | 50 |
} |
51 |
|
|
51 |
|
|
52 | 52 |
return false; |
53 | 53 |
} |
54 | 54 |
} |
Also available in: Unified diff
smaller changes in io wizards and navigator menu