Project

General

Profile

« Previous | Next » 

Revision 5280b4d9

Added by Katja Luther over 8 years ago

do not provide menu item change synonym to accepted taxon for homotyp. synonym of accepted taxon and fix new taxonNode creation

View differences:

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());
92
		//excludeTaxa.add(taxon.getUuid());//there are some cases where the accepted taxon should be the parent of the new created accepted taxon
93 93

  
94
		TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", excludeTaxa, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
94
		TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", null, 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
	
38 40

  
39 41
	/**
40 42
	 * <p>Constructor for NameEditorMenuPropertyTester.</p>
......
76 78
			}
77 79
			else if(ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS.equals(property)){
78 80
				return isAcceptedAndHasNoHomotypicSynonyms(selectedElement);
81
			}else if (NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED.equals(property)){
82
				return isNotHomotypicSynonymOfAcceptedTaxon(selectedElement);
79 83
			}
84
			
80 85
		}
81 86

  
82 87
		return false;
......
90 95
		}
91 96
		return false;
92 97
	}
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

  
93 111

  
94 112
	/**
95 113
	 * @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;
19 20
import eu.etaxonomy.cdm.model.taxon.Classification;
20 21
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
21 22
import eu.etaxonomy.cdm.model.taxon.Taxon;
......
52 53
            getConversationHolder().bind();
53 54
            ITaxonTreeNode parent = getParentTreeNode();
54 55
            Taxon taxon = taxonNodePage.getTaxon();
56
            Reference sec = taxon.getSec();
57
            taxon.setSec(null);
55 58
            try{
56 59
            	UpdateResult result = CdmStore.getService(ITaxonNodeService.class).createNewTaxonNode(parent.getUuid(), taxon, parent.getReference(), parent.getMicroReference());
57 60
            		
......
64 67
                }*/
65 68
            	generatedTaxonNodeUuid = result.getCdmEntity().getUuid();
66 69
            	TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(generatedTaxonNodeUuid);
67

  
70
            	taxonNode.getTaxon().setSec(sec);
71
            	CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
68 72
                Set<CdmBase> affectedObjects = new HashSet<CdmBase>();
69 73
                if (result.getUpdatedObjects().iterator().hasNext()){
70 74
                	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
               
148 149
            }
149 150
        }
150 151
    }
......
274 275
	private void setTaxon(TaxonNameBase taxonName) {
275 276
		Reference secundum = null;
276 277
		if (getParentTreeNode() != null) {
277
			if (this.secReference != null){
278
				secundum = this.secReference;
278
			if (this.selection_SecRef.getEntity() != null){
279
				secundum = this.selection_SecRef.getEntity();
279 280
			} /*else if (getParentTreeNode() instanceof Classification) {
280 281
				secundum = ((Classification) getParentTreeNode())
281 282
						.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;
11 12
import org.eclipse.jface.wizard.WizardDialog;
12 13
import org.eclipse.swt.SWT;
13 14
import org.eclipse.swt.events.SelectionAdapter;
......
419 420
		/** {@inheritDoc} */
420 421
		@Override
421 422
		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
			}
422 427
			WizardDialog dialog = new WizardDialog(selectionElement.getShell(),
423 428
					new EditFromSelectionWizard(selectionElement));
424 429
			if (dialog.open() == IStatus.OK) {

Also available in: Unified diff