Revision b8da2ad7
Added by Katja Luther about 7 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
33 | 33 |
TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME); |
34 | 34 |
|
35 | 35 |
for(AbstractGroupedContainer<TaxonBase> containerWithEmptyName : editor.getEmptyContainers()){ |
36 |
editor.removeGroup(containerWithEmptyName.getGroup()); |
|
36 | 37 |
doExecute(event, editor, containerWithEmptyName.getData()); |
37 | 38 |
} |
38 |
|
|
39 |
|
|
39 | 40 |
return null; |
40 | 41 |
} |
41 | 42 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteTaxonBaseHandler.java | ||
---|---|---|
22 | 22 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
23 | 23 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
24 | 24 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
25 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
26 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
|
25 | 27 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
26 | 28 |
import eu.etaxonomy.taxeditor.editor.Page; |
27 | 29 |
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; |
... | ... | |
68 | 70 |
MessagingUtils.error(getClass(), e); |
69 | 71 |
} |
70 | 72 |
IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); |
73 |
if (selectedElement instanceof TaxonBase){ |
|
74 |
if (((TaxonBase)selectedElement).getId() == 0){ |
|
75 |
if (selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()) { |
|
76 |
editor.getTaxon().removeTaxon((Taxon)selectedElement, TaxonRelationshipType.MISAPPLIED_NAME_FOR()); |
|
77 |
|
|
78 |
} else if (selectedElement instanceof Synonym){ |
|
79 |
editor.getTaxon().removeSynonym((Synonym)selectedElement); |
|
80 |
} |
|
81 |
this.editor.redraw(); |
|
82 |
return; |
|
83 |
|
|
84 |
} |
|
85 |
|
|
86 |
} |
|
87 |
|
|
71 | 88 |
// synonym |
72 | 89 |
if(selectedElement instanceof Synonym){ |
73 | 90 |
SynonymDeletionConfigurator deleteConfig = new SynonymDeletionConfigurator(); |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java | ||
---|---|---|
54 | 54 |
Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
55 | 55 |
super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled); |
56 | 56 |
this.synonym = synonym; |
57 |
this.element = taxon; |
|
57 | 58 |
} |
58 | 59 |
|
59 | 60 |
/** {@inheritDoc} */ |
... | ... | |
71 | 72 |
controller = CdmStore.getCurrentApplicationConfiguration(); |
72 | 73 |
|
73 | 74 |
ITaxonService service = controller.getTaxonService(); |
74 |
if (synonym.getId() == 0){ |
|
75 |
element.removeSynonym(synonym); |
|
76 | 75 |
|
77 |
} else { |
|
78 | 76 |
|
79 |
result = service.deleteSynonym(synonym.getUuid(), (SynonymDeletionConfigurator)configurator); |
|
77 |
result = service.deleteSynonym(synonym.getUuid(), (SynonymDeletionConfigurator)configurator); |
|
78 |
|
|
80 | 79 |
|
81 |
} |
|
82 | 80 |
|
83 | 81 |
monitor.worked(40); |
84 | 82 |
|
Also available in: Unified diff
fix #6424: check if name is already persisted before trying to delete