Project

General

Profile

« Previous | Next » 

Revision 1b8e2548

Added by Katja Luther over 9 years ago

fix drag&drop for synonyms to another accepted taxon

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDropTargetListener.java
4 4
package eu.etaxonomy.taxeditor.editor.name.dnd;
5 5

  
6 6
import org.eclipse.core.runtime.Assert;
7
import org.eclipse.swt.SWTException;
7 8
import org.eclipse.swt.dnd.DND;
8 9
import org.eclipse.swt.dnd.DropTargetAdapter;
9 10
import org.eclipse.swt.dnd.DropTargetEvent;
10 11

  
11 12
import eu.etaxonomy.cdm.model.common.ICdmBase;
12 13
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
14
import eu.etaxonomy.cdm.model.reference.Reference;
13 15
import eu.etaxonomy.cdm.model.taxon.Synonym;
16
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
17
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
14 18
import eu.etaxonomy.cdm.model.taxon.Taxon;
15 19
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
16 20
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
......
24 28
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation;
25 29
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicGroupOperation;
26 30
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToMisapplicationOperation;
31
import eu.etaxonomy.taxeditor.editor.name.operation.MoveSynonymToAnotherAcceptedTaxonOperation;
27 32
import eu.etaxonomy.taxeditor.model.MessagingUtils;
28 33
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
29 34

  
......
36 41
public class NameEditorDropTargetListener extends DropTargetAdapter {
37 42
		
38 43
	private IDropTargetable target;
44
	
39 45

  
40 46
	/**
41 47
	 * <p>Constructor for NameEditorDropTargetListener.</p>
......
84 90
		} else {
85 91
			EditorUtil.executeOperation(operation);
86 92
		}
93
		target.getEditor().getConversationHolder().commit();
94
		if (!target.equals(EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor())){
95
			((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).redraw();
96
			((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).getConversationHolder().commit();
97
			
98
		}
99
		target.getEditor().redraw();
100
		
87 101
	}
88 102
	
89 103
	private AbstractPostOperation createOperation(TaxonBase taxonBase) {
......
102 116
						getEditor().getTaxon(), synonym, target);
103 117
			}
104 118
			else if(target instanceof TaxonNameEditor){
105
				return new ChangeHomotypicGroupOperation("Change Homotypical Group", getEditor().getUndoContext(), 
119
				if (target.equals(getEditor())){
120
					return new ChangeHomotypicGroupOperation("Change Homotypical Group", getEditor().getUndoContext(), 
106 121
						getEditor().getTaxon(), synonym, null, target);
122
				} else{
123
					getEditor().getConversationHolder().commit();
124
					((TaxonNameEditor) target).getConversationHolder().commit();
125
					
126
					return new MoveSynonymToAnotherAcceptedTaxonOperation("Change accepted Taxon", getEditor().getUndoContext(), getEditor().getTaxon().getUuid(), synonym.getUuid(), ((TaxonNameEditor) target).getTaxon(), null );
127
					
128
				}
107 129
			}
108 130
			
109 131
		}else if(taxonBase instanceof Taxon){
......
156 178
	 * 
157 179
	 */
158 180
	private TaxonNameEditor getEditor() {
159
		return target.getEditor();
181
		return (TaxonNameEditor) EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor();
160 182
	}
161 183
}

Also available in: Unified diff