Revision 30afcea0
fix #5616 Add check for orphaned taxa to CdmViewer context menu
- removed default handler for this
eu.etaxonomy.taxeditor.bulkeditor/plugin.xml | ||
---|---|---|
542 | 542 |
</viewCommandMapping> |
543 | 543 |
<viewCommandMapping |
544 | 544 |
commandId="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity" |
545 |
selection="eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache" |
|
546 |
viewerName="%viewCommandMapping.viewerName.BULK_EDITOR"> |
|
547 |
</viewCommandMapping> |
|
548 |
<viewCommandMapping |
|
549 |
commandId="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity" |
|
550 | 545 |
selection="eu.etaxonomy.cdm.model.common.IdentifiableEntity" |
551 | 546 |
viewerName="%viewCommandMapping.viewerName.BULK_EDITOR"> |
552 | 547 |
</viewCommandMapping> |
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
1632 | 1632 |
name="%command.name.41"> |
1633 | 1633 |
</command> |
1634 | 1634 |
<command |
1635 |
defaultHandler="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonHandler" |
|
1636 | 1635 |
id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon" |
1637 | 1636 |
name="%command.name.42"> |
1638 | 1637 |
<commandParameter |
... | ... | |
1952 | 1951 |
</test> |
1953 | 1952 |
</with> |
1954 | 1953 |
</definition> |
1954 |
<definition |
|
1955 |
id="isOrphanedTaxon"> |
|
1956 |
<with |
|
1957 |
variable="selection"> |
|
1958 |
<test |
|
1959 |
forcePluginActivation="true" |
|
1960 |
property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isOrphaned"> |
|
1961 |
</test> |
|
1962 |
</with> |
|
1963 |
</definition> |
|
1955 | 1964 |
</extension> |
1956 | 1965 |
<extension |
1957 | 1966 |
point="org.eclipse.core.expressions.propertyTesters"> |
... | ... | |
1959 | 1968 |
class="eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester" |
1960 | 1969 |
id="eu.etaxonomy.taxeditor.editor.name.propertyTester" |
1961 | 1970 |
namespace="eu.etaxonomy.taxeditor.editor.name.propertyTester" |
1962 |
properties="isAcceptedTaxon,isSynonym,isMisapplication,isTaxonBase,hasEmptyNames,isAcceptedAndHasNoHomotypicSynonyms,isNotHomotypicSynonymOfAcceptedTaxon,isSynonymInHomotypicalGroupWithMoreSynonyms" |
|
1971 |
properties="isAcceptedTaxon,isSynonym,isMisapplication,isTaxonBase,hasEmptyNames,isAcceptedAndHasNoHomotypicSynonyms,isNotHomotypicSynonymOfAcceptedTaxon,isSynonymInHomotypicalGroupWithMoreSynonyms,isOrphaned"
|
|
1963 | 1972 |
type="org.eclipse.jface.viewers.IStructuredSelection"> |
1964 | 1973 |
</propertyTester> |
1965 | 1974 |
<propertyTester |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import org.eclipse.jface.viewers.IStructuredSelection; |
14 | 14 |
|
15 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
15 | 16 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
16 | 17 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
17 | 18 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
19 |
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; |
|
18 | 20 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
19 | 21 |
import eu.etaxonomy.taxeditor.editor.Page; |
20 | 22 |
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; |
23 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
21 | 24 |
|
22 | 25 |
/** |
23 | 26 |
* <p>NameEditorMenuPropertyTester class.</p> |
... | ... | |
37 | 40 |
private static final String ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS = "isAcceptedAndHasNoHomotypicSynonyms"; |
38 | 41 |
private static final String NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED = "isNotHomotypicSynonymOfAcceptedTaxon"; |
39 | 42 |
private static final String SYNONYM_WITH_HOMOTYPIC_SYNONYMS = "isSynonymInHomotypicalGroupWithMoreSynonyms"; |
43 |
private static final String IS_ORPHANED = "isOrphaned"; |
|
40 | 44 |
|
41 | 45 |
/** |
42 | 46 |
* <p>Constructor for NameEditorMenuPropertyTester.</p> |
... | ... | |
57 | 61 |
IStructuredSelection selection = (IStructuredSelection) receiver; |
58 | 62 |
|
59 | 63 |
Object selectedElement = selection.getFirstElement(); |
64 |
if(selectedElement instanceof UuidAndTitleCache){ |
|
65 |
UuidAndTitleCache uuidAndTitleCache = (UuidAndTitleCache<?>)selectedElement; |
|
66 |
CdmBase cdmBase = CdmStore.getCommonService().find(uuidAndTitleCache.getType(), uuidAndTitleCache.getUuid()); |
|
67 |
selectedElement = cdmBase; |
|
68 |
} |
|
60 | 69 |
|
61 | 70 |
if(ACCEPTED.equals(property)){ |
62 | 71 |
return isAccepted(selectedElement); |
... | ... | |
85 | 94 |
else if (SYNONYM_WITH_HOMOTYPIC_SYNONYMS.equals(property)){ |
86 | 95 |
return isSynonymInHomotypicalGroupWithMoreSynonyms(selectedElement); |
87 | 96 |
} |
97 |
else if (IS_ORPHANED.equals(property)){ |
|
98 |
return isOrphaned(selectedElement); |
|
99 |
} |
|
88 | 100 |
|
89 | 101 |
} |
90 | 102 |
|
... | ... | |
99 | 111 |
} |
100 | 112 |
return false; |
101 | 113 |
} |
102 |
|
|
114 |
|
|
103 | 115 |
private boolean isSynonymInHomotypicalGroupWithMoreSynonyms(Object selectedElement) { |
104 | 116 |
if (isSynonym(selectedElement)){ |
105 | 117 |
Synonym synonym = (Synonym) selectedElement; |
... | ... | |
156 | 168 |
private boolean isAccepted(Object selectedElement) { |
157 | 169 |
return (selectedElement instanceof Taxon && ! ((Taxon) selectedElement).isMisapplication()) ? true : false; |
158 | 170 |
} |
171 |
|
|
172 |
private boolean isOrphaned(Object selectedElement) { |
|
173 |
return selectedElement instanceof Taxon && ((Taxon) selectedElement).isOrphaned(); |
|
174 |
} |
|
159 | 175 |
} |
eu.etaxonomy.taxeditor.navigation/plugin.xml | ||
---|---|---|
553 | 553 |
</with> |
554 | 554 |
</activeWhen> |
555 | 555 |
</handler> |
556 |
<handler |
|
557 |
class="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonHandler" |
|
558 |
commandId="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon"> |
|
559 |
<activeWhen> |
|
560 |
<and> |
|
561 |
<not> |
|
562 |
<reference |
|
563 |
definitionId="isOrphanedTaxon"> |
|
564 |
</reference> |
|
565 |
</not> |
|
566 |
</and> |
|
567 |
</activeWhen> |
|
568 |
</handler> |
|
556 | 569 |
</extension> |
557 | 570 |
|
558 | 571 |
|
Also available in: Unified diff