Revision e30acb09
Added by Katja Luther over 7 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java | ||
---|---|---|
89 | 89 |
TaxonNode parentNode = (TaxonNode) HibernateProxyHelper.deproxy(((TaxonEditorInput) input).getTaxonNode().getParent()); |
90 | 90 |
|
91 | 91 |
List<UUID> excludeTaxa = new ArrayList<UUID>(); |
92 |
//excludeTaxa.add(taxon.getUuid());//there are some cases where the accepted taxon should be the parent of the new created accepted taxon
|
|
92 |
excludeTaxa.add(taxon.getUuid());
|
|
93 | 93 |
|
94 |
TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", null, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
|
|
94 |
TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", excludeTaxa, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
|
|
95 | 95 |
|
96 | 96 |
|
97 | 97 |
if(newParentNode != null){ |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java | ||
---|---|---|
35 | 35 |
private static final String CONCEPT = "isConceptRelation"; |
36 | 36 |
private static final String EMPTY_NAMES = "hasEmptyNames"; |
37 | 37 |
private static final String ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS = "isAcceptedAndHasNoHomotypicSynonyms"; |
38 |
private static final String NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED = "isNotHomotypicSynonymOfAcceptedTaxon"; |
|
39 |
|
|
40 | 38 |
|
41 | 39 |
/** |
42 | 40 |
* <p>Constructor for NameEditorMenuPropertyTester.</p> |
... | ... | |
78 | 76 |
} |
79 | 77 |
else if(ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS.equals(property)){ |
80 | 78 |
return isAcceptedAndHasNoHomotypicSynonyms(selectedElement); |
81 |
}else if (NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED.equals(property)){ |
|
82 |
return isNotHomotypicSynonymOfAcceptedTaxon(selectedElement); |
|
83 | 79 |
} |
84 |
|
|
85 | 80 |
} |
86 | 81 |
|
87 | 82 |
return false; |
... | ... | |
95 | 90 |
} |
96 | 91 |
return false; |
97 | 92 |
} |
98 |
|
|
99 |
private boolean isNotHomotypicSynonymOfAcceptedTaxon(Object selectedElement) { |
|
100 |
if (isSynonym(selectedElement)){ |
|
101 |
Synonym synonym = (Synonym) selectedElement; |
|
102 |
for (Taxon taxon:synonym.getAcceptedTaxa()){ |
|
103 |
if (taxon.getHomotypicGroup().equals(synonym.getHomotypicGroup())){ |
|
104 |
return false; |
|
105 |
} |
|
106 |
} |
|
107 |
} |
|
108 |
return true; |
|
109 |
} |
|
110 |
|
|
111 | 93 |
|
112 | 94 |
/** |
113 | 95 |
* @param receiver |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonNodeWizard.java | ||
---|---|---|
16 | 16 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
17 | 17 |
import eu.etaxonomy.cdm.api.service.UpdateResult; |
18 | 18 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
19 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
20 | 19 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
21 | 20 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
22 | 21 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
53 | 52 |
getConversationHolder().bind(); |
54 | 53 |
ITaxonTreeNode parent = getParentTreeNode(); |
55 | 54 |
Taxon taxon = taxonNodePage.getTaxon(); |
56 |
Reference sec = taxon.getSec(); |
|
57 |
taxon.setSec(null); |
|
58 | 55 |
try{ |
59 | 56 |
UpdateResult result = CdmStore.getService(ITaxonNodeService.class).createNewTaxonNode(parent.getUuid(), taxon, parent.getReference(), parent.getMicroReference()); |
60 | 57 |
|
... | ... | |
67 | 64 |
}*/ |
68 | 65 |
generatedTaxonNodeUuid = result.getCdmEntity().getUuid(); |
69 | 66 |
TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(generatedTaxonNodeUuid); |
70 |
taxonNode.getTaxon().setSec(sec); |
|
71 |
CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true); |
|
67 |
|
|
72 | 68 |
Set<CdmBase> affectedObjects = new HashSet<CdmBase>(); |
73 | 69 |
if (result.getUpdatedObjects().iterator().hasNext()){ |
74 | 70 |
TaxonNode parentNode = (TaxonNode)result.getUpdatedObjects().iterator().next(); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java | ||
---|---|---|
145 | 145 |
} |
146 | 146 |
} |
147 | 147 |
} |
148 |
|
|
149 | 148 |
} |
150 | 149 |
} |
151 | 150 |
} |
... | ... | |
275 | 274 |
private void setTaxon(TaxonNameBase taxonName) { |
276 | 275 |
Reference secundum = null; |
277 | 276 |
if (getParentTreeNode() != null) { |
278 |
if (this.selection_SecRef.getEntity() != null){
|
|
279 |
secundum = this.selection_SecRef.getEntity();
|
|
277 |
if (this.secReference != null){
|
|
278 |
secundum = this.secReference;
|
|
280 | 279 |
} /*else if (getParentTreeNode() instanceof Classification) { |
281 | 280 |
secundum = ((Classification) getParentTreeNode()) |
282 | 281 |
.getReference(); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EntitySelectionElement.java | ||
---|---|---|
8 | 8 |
import java.util.Observer; |
9 | 9 |
|
10 | 10 |
import org.eclipse.core.runtime.IStatus; |
11 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
12 | 11 |
import org.eclipse.jface.wizard.WizardDialog; |
13 | 12 |
import org.eclipse.swt.SWT; |
14 | 13 |
import org.eclipse.swt.events.SelectionAdapter; |
... | ... | |
420 | 419 |
/** {@inheritDoc} */ |
421 | 420 |
@Override |
422 | 421 |
public void widgetSelected(SelectionEvent e) { |
423 |
if (StoreUtil.getActiveEditor().isDirty()){ |
|
424 |
MessageDialog.openInformation(null,"Save changes", "You have made changes that must be saved before this query can be executed"); |
|
425 |
return; |
|
426 |
} |
|
427 | 422 |
WizardDialog dialog = new WizardDialog(selectionElement.getShell(), |
428 | 423 |
new EditFromSelectionWizard(selectionElement)); |
429 | 424 |
if (dialog.open() == IStatus.OK) { |
Also available in: Unified diff
revert the commit, which is already in hotfix branch